Identify reports using job IDs
You can set job IDs as a way to identify which particular job a profiling report report is for. This is useful if you direct the log messages for download reports are being sent undifferentiated into some shared destination. For example, you can direct the profiling report log messages to Slack, but then you won’t necessarily know which particular batch job the report is for.
If set a a job ID, it will let you know which job the report is from. You can set the job ID in three different ways.
First, if you’re using
python -m sciagraph:
$ python -m sciagraph --job-id april-2022-pictures run \ process-pictures.py --load-data=april-2022
Second, you can also set an environment variable, which is useful if you’re using
$ export SCIAGRAPH_MODE=process $ export SCIAGRAPH_JOB_ID=april-2022-pictures $ python process-pictures.py --load-data=april-2022
Finally, you can set the job ID for the current job from within the running Python process.
Just add a call to
sciagraph.api.set_job_id() in your application code.
from sciagraph.api import set_job_id def main(): # ... your existing application setup code... my_job_id = "some value based on this particular run" set_job_id(my_job_id) # ... your existing application running code ...
If you’re not profiling your application, the call to
set_job_id() will silently do nothing.