Skip to content

Create Workflow Triggers To Spawn Jobs

Jobs represent work to be done. Specifically, a Job is a request to run a Workflow given a certain Object as its input. The Runtime system will spawn a new Job when:

  1. An Object,
  2. is assigned an Object Type,
  3. which is associated with a Workflow,
  4. through a Trigger.

Job Triggering

Job Triggering

Thus, to empower the Runtime to recognize and spawn new jobs to be done, a new Trigger must be registered with the system. Add a trigger to the codebase in nmdc_runtime.api.boot.triggers. You will need an Object Type ID and a Workflow ID

Workflows are also registered with the system via a code module, nmdc_runtime.api.boot.workflows. Find your target workflow ID there, or add it there if need be.

Finally, Object Types are registered in a similar manner, via nmdc_runtime.api.boot.object_types. Find your target object type ID there, or add it there if need be.

Once a valid trigger is registered with the system, the process_workflow_job_triggers Sensor in nmdc_runtime.site.repository can sense when there are object IDs tagged with object types corresponding to a registered trigger. If a job hasn't yet been created for the object-type-triggered workflow with the given object as input, the Runtime will create this job so that a site can claim and run the job.