-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#925: crontab for submitting the submit_pending_jobs job
- Loading branch information
1 parent
ebff25a
commit 0cb5c5c
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SHELL=/bin/bash | ||
|
||
|
||
####################################################################### | ||
# hysdsops user crontab | ||
# | ||
# log output to system log using `logger`. On Oracle Linux 8, logs are | ||
# written to /var/log/messages (on other systems: /var/log/syslog). | ||
# System logging configuration at /etc/rsyslog.conf. | ||
# | ||
# | ||
####################################################################### | ||
|
||
#@hourly $HOME/.local/bin/cron/submit_job.py 2>&1 | logger -i -p user.notice -t submit_pending_jobs-task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python | ||
|
||
import uuid | ||
import sys | ||
import hashlib | ||
import re | ||
import yaml | ||
from hysds_commons.job_utils import submit_mozart_job | ||
|
||
# have yaml parse regular expressions | ||
yaml.SafeLoader.add_constructor( | ||
u"tag:yaml.org,2002:python/regexp", lambda l, n: re.compile(l.construct_scalar(n)) | ||
) | ||
|
||
settings = yaml.safe_load(open("/export/home/hysdsops/verdi/etc/settings.yaml")) | ||
release_version = settings["RELEASE_VERSION"] | ||
generated_uuid = str(uuid.uuid4()) | ||
payload_hash = hashlib.md5(generated_uuid.encode()).hexdigest() | ||
|
||
result = submit_mozart_job( | ||
hysdsio={ | ||
"id": generated_uuid, | ||
"params": [], | ||
"job-specification": f"job-submit_pending_jobs:{release_version}", | ||
}, | ||
product={}, | ||
rule={ | ||
"rule_name": f"trigger-submit_pending_jobs", | ||
"queue": "factotum-job_worker-small", #"opera-job_worker-submit_pending_jobs" | ||
"priority": "0", | ||
"kwargs": "{}", | ||
"enable_dedup": True | ||
}, | ||
queue=None, | ||
job_name="job-submit_pending_jobs", | ||
payload_hash=payload_hash, # we have to provide a unique payload hash so that this doesn't dedup | ||
enable_dedup=None, | ||
soft_time_limit=None, | ||
time_limit=None, | ||
component=None | ||
) | ||
|
||
print(result) |