-
Notifications
You must be signed in to change notification settings - Fork 45
Command Messages
Derick Faller edited this page Oct 31, 2018
·
52 revisions
This is an overview of the various command messages:
- blocked_jobs
- cancel_jobs
- cancel_jobs_bulk
- completed_jobs
- create_batch_recipes
- create_conditions
- create_job_exe_end
- create_jobs
- create_recipes
- delete_files
- failed_jobs
- pending_jobs
- process_condition
- process_job_input
- process_recipe_input
- publish_job
- queued_jobs
- purge_jobs
- purge_recipe
- purge_source_file
- reprocess_recipes
- requeue_jobs
- requeue_jobs_bulk
- restart_scheduler
- running_jobs
- spawn_delete_files_job
- supersede_recipe_nodes
- uncancel_jobs
- unpublish_jobs
- update_batch_metrics
- update_recipe_metrics
- update_recipe
- update_recipes
- Inputs: Up to 1000 job IDs, status change time
- Next Commands: update_recipe_metrics
-
Execute:
- Select and lock applicable job models
- Update applicable jobs to BLOCKED status
- Send update_recipe_metrics messages for affected recipes
- Inputs: Up to 100 job IDs, cancel time
- Next Commands: update_recipe_metrics, update_recipe
-
Execute:
- Select and lock applicable job models
- Update applicable jobs to CANCELED status
- Mark applicable queue models as canceled
- Send update_recipe_metrics messages for affected recipes
- Send update_recipe messages to update dependent jobs that should now be BLOCKED
- Inputs: Filter fields for started time, ended time, error categories, error IDs, job IDs, job type IDs, and status, current job ID field to track progress filtering across all jobs
- Next Commands: cancel_jobs_bulk, cancel_jobs
-
Execute:
- Select up to a max batch size of job models that fit the filter criteria
- Compile list of job models that can be canceled
- Send new cancel_jobs_bulk message with current job ID set to lowest job retrieved so progress is made through the jobs table
- Send cancel_jobs messages for filtered jobs that can be canceled
- Inputs: Up to 100 (job_id, exe_num) pairs, ended time
- Next Commands: publish_job, update_recipe_metrics, update_recipe
-
Execute:
- Select and lock applicable job models
- Ignore jobs for which this message is obsolete
- Update jobs to COMPLETED that are in valid state
- Set job output if execution output has been set
- Query all jobs that are both COMPLETED and have output and create update_recipe and publish_job messages for them
- Send update_recipe_metrics messages for affected recipes
- Inputs: Batch ID, flag to indicate if previous batch recipes are done, current recipe ID field to track progress re-processing previous batch recipes
- Next Commands: create_batch_recipes, create_recipes
-
Execute:
- Retrieve batch
- If this batch is re-processing a previous batch, select up to a max size of recipes from the previous batch (recipes < the current recipe ID tracker)
- Send create_recipes messages to re-process the previous batch recipes
- If not finished with previous batch, send new create_batch_recipes message with current recipe ID set to lowest recipe retrieved so progress is made through the previous batch recipes
- Inputs: root_recipe_id, recipe_id, batch_id, recipe_condition tuples to describe conditions to create
- Next Commands: process_condition
-
Execute:
- Perform locking in a database transaction
- Look for existing conditions to see if message has already run, if so then skip to (5)
- Bulk create new condition model(s)
- Bulk create new recipe_node models
- Database transaction is over, now send messages
- For each condition, if its process_input flag is true, send process_condition message
- Inputs: Up to 10 job_exe_end models
- Next Commands: None
-
Execute:
- Retrieve job_exe_end models with the given IDs to filter out any models that already exist
- Bulk create the job_exe_end models that don't exist
- Inputs: event_id, create_jobs_type (determines a job made from input data or jobs made for recipe), job_type_name (input data type), job_type_version (input data type), job_type_rev_num (input data type), input_data (input data type), root_recipe_id (recipe type), superseded_recipe_id (recipe type), recipe_id (recipe type), batch_id (recipe type), recipe_jobs tuples to describe jobs to create (recipe type)
- Next Commands: process_job_input, update_recipe_metrics
-
Execute:
- Perform locking in a database transaction
- Look for existing jobs to see if message has already run, if so then skip to (7)
- If jobs are within a recipe that is superseding another recipe, retrieve the superseded jobs
- Retrieve job type revision(s) for job(s) to create
- Bulk create new job model(s)
- Bulk create new recipe_node models if new jobs are in a recipe
- Database transaction is over, now send messages
- For each new job, if it has data or it's in a recipe and process_input flag is true, send process_job_input message
- Send update_recipe_metrics message if in a recipe
- Inputs: batch_id, event_id, forced_nodes, create_recipes_type (determines a reprocess or sub-recipes type), recipe_type_name (reprocess), recipe_type_rev_num (reprocess), root_recipe_ids (reprocess), recipe_id (sub-recipes), root_recipe_id (sub-recipes), superseded_recipe_id (sub-recipes), sub_recipes (sub-recipes)
- Next Commands: supersede_recipe_nodes, process_recipe_input, update_recipe_metrics
-
Execute:
- Perform locking in a database transaction
- Look for existing recipes to see if message has already run, if so then skip to (8)
- If superseding, get superseded models and create diffs between old and new revisions
- Bulk create new recipe models
- If this is a reprocess type, copy data from superseded recipe model and supersede reprocessed models
- Bulk create new recipe_node models if new recipes are sub-recipes
- Copy jobs and sub-recipes from superseded recipe (for identical nodes)
- Database transaction is over, now send messages
- If new recipe is superseding another recipe, then it is a reprocess so create supersede_recipe_nodes messages
- For each new recipe, if it has data or it's in a recipe and process_input flag is true, send process_recipe_input message
- Send update_recipe_metrics message if in a recipe
- Inputs: Up to 100 ScaleFile IDs, job_id, trigger_id, source_file_id, purge flag
- Next Commands: purge_jobs
-
Execute:
- If purge flag is
true
: Execute query to delete given ScaleFile entries and callpurge_jobs
for associated jobs - If purge flag is
false
: Execute query to mark given ScaleFile entries as deleted and unpublished
- If purge flag is
- Inputs: Up to 100 (job_id, exe_num) pairs sorted by error_id, ended time
- Next Commands: queued_jobs (for retried jobs), update_recipe_metrics, update_recipe (for failed jobs)
-
Execute:
- Select and lock applicable job models, then select for job related fields
- Ignore jobs for which this message is obsolete
- Jobs to retry are sent in queued_jobs messages
- Jobs that aren't retried are updated to FAILED status and sent in update_recipe messages
- Send update_recipe_metrics messages for affected recipes
- Inputs: Up to 1000 job IDs, status change time
- Next Commands: update_recipe_metrics
-
Execute:
- Select and lock applicable job models
- Update applicable jobs to PENDING status
- Send update_recipe_metrics messages for affected recipes
- Inputs: Condition ID
- Next Commands: update_recipe
-
Execute:
- Query for condition model with related recipe and recipe__recipe_type_rev models
- If condition has not been processed yet:
- Query condition's recipe dependencies to get their output data
- Combine dependency outputs into condition's data, and then validate and set data on the condition model
- Apply the condition's data filter to its data, and set the condition as processed with is_accepted corresponding to whether the filter accepted the data
- Send update_recipe message to update the condition's recipe
- Inputs: Job ID
- Next Commands: queued_jobs
-
Execute:
- Query for job model with related job_type_rev, recipe and recipe__recipe_type_rev models
- If job is in recipe and does not have input data yet:
- Query job's recipe dependencies to get their output data
- Combine dependency outputs into job's input data, and then validate and set input data on the job model
- In a transaction:
- Lock job model
- Bulk create job input file models
- Update job input meta-data fields (input_file_size, source_started, etc)
- If job has never been queued, send queued_jobs message
- Inputs: Recipe ID, forced nodes (optional)
- Next Commands: update_recipe
-
Execute:
- Query for recipe model with related recipe_type_rev, recipe and recipe__recipe_type_rev models
- If recipe is a sub-recipe and does not have input data yet:
- Query sub-recipe's recipe dependencies to get their output data
- Combine dependency outputs into sub-recipe's input data, and then validate and set input data on the sub-recipe model
- In a transaction:
- Lock recipe model
- Bulk create recipe input file models
- Update recipe input meta-data fields (input_file_size, source_started, etc)
- Send update_recipe message for recipe
- Inputs: Job ID
- Next Commands: None
-
Execute:
- Select job model with latest job_exe model
- Publish the job's products
- Inputs: Up to 100 (job_id, exe_num) pairs, requeue flag, optional priority
- Next Commands: update_recipe_metrics
-
Execute:
- Select and lock applicable job models
- Ignore jobs for which this message is obsolete (also only accept jobs for first queue or re-queue depending on requeue flag)
- Update applicable jobs to QUEUED status
- Select QUEUED jobs with related fields
- Select input files for QUEUED jobs
- Bulk create new queue models
- Send update_recipe_metrics messages for affected recipes
- Inputs: Up to 100 job IDs, trigger_id, source_file_id
- Next Commands: purge_recipe if part of recipe; purge_source_file
-
Execute:
- Call
purge_source_file
for the given source_file_id - Select JobExecution where job ID is in the list of given purge_job_ids
- Select and Delete the following models (in order) where job_exe was selected:
- TaskUpdate
- JobExecutionOutput
- JobExecutionEnd
- Delete selected job_exes
- Select and delete the following (in order) where job ID is in the list of given purge_job_ids:
- FileAncestryLink
- BatchJob
- RecipeNode
- JobInputFile
- Queue
- Job
- Call
- Inputs: recipe_id, trigger_id, source_file_id
- Next Commands: spawn_delete_files_job if leaf jobs in recipe; purge_recipe if leaf recipes in recipe; purge_source_file for input source files
-
Execute:
- Call
purge_source_file
for the given source_file_id - If there are leaf nodes (no jobs/recipes dependent) in given recipe:
-
spawn_delete_files_job
for leaf jobs - purges leaf jobs -
purge_recipe
for leaf recipes - purges leaf recipes
-
- If not (2) above and if the given recipe is part of another (parent) recipe:
-
purge_recipe
for parent recipe - purges parent recipe
-
- If not (2) above and if the given recipe is superseded:
-
purge_recipe
for superseding recipe - purges superseding recipe
-
- If not (2) above delete the following where recipe == the given recipe:
- BatchRecipe
- RecipeNode
- RecipeInputFile
- Recipe
- Call
- Inputs: source_file_id, trigger_id
- Next Commands: spawn_delete_files_job for jobs that take source file as an input; purge_recipe for recipes that take source file as an input
-
Execute:
- If there are jobs that are not part of a recipe and take the given source file as an input:
-
spawn_delete_files_job
for jobs in order to purge them
-
- If there are recipes that take the given source file as an input:
-
purge_recipe
for recipes in order to purge them
-
- If not (1) and (2) above, delete the following where source_file_id == the given recipe:
- Ingest
- ScaleFile
- If there are jobs that are not part of a recipe and take the given source file as an input:
- NOTE: This message is deprecated. Please use create_recipes instead
- Inputs: Up to 100 root recipe IDs, new recipe type revision ID, event ID, all_jobs boolean, job names, optional batch ID
- Next Commands: process_recipe_input, cancel_jobs, unpublish_jobs
-
Execute:
- Select and lock latest (non-superseded) recipe models for the given root recipe IDs
- Select recipe type model and all needed recipe type revision models
- Bulk create new recipe models
- Supersede old recipe models
- Select recipe_job models for all jobs in superseded recipes
- Bulk create recipe_job models for jobs that are being copied into new recipes
- Supersede old job models
- Send cancel_jobs messages for all superseded jobs
- Send unpublish_jobs messages for all jobs "deleted" from the superseded recipes
- Send process_recipe_input messages for all new recipes
- Inputs: Up to 100 (job_id, exe_num) pairs, optional priority
- Next Commands: queued_jobs, uncancel_jobs
-
Execute:
- Select job models and collect jobs that are valid for re-queue
- Collect jobs that are valid for being uncanceled
- Increase max_tries field for jobs that will be re-queued
- Send queued_jobs messages to queue the jobs that will be re-queued
- Send uncancel_jobs messages to uncancel jobs
- Inputs: Filter fields for started time, ended time, error categories, error IDs, job IDs, job type IDs, and status, current job ID field to track progress filtering across all jobs, priority
- Next Commands: requeue_jobs_bulk, requeue_jobs
-
Execute:
- Select up to a max batch size of job models that fit the filter criteria
- Compile list of job models that can be re-queued
- Send new requeue_jobs_bulk message with current job ID set to lowest job retrieved so progress is made through the jobs table
- Send requeue_jobs messages for filtered jobs that can be re-queued
- Inputs: When timestamp
- Next Commands: failed_jobs, create_job_exe_end
-
Execute:
- Select job_exe models that match QUEUED/RUNNING job models
- Create failed_jobs messages for (job ID and exe_num) pairs with scheduler-lost error
- Create create_job_exe_end messages for job_exe models containing failed job_exe_end models with scheduler-lost error
- Inputs: Up to 100 (job_id, exe_num) pairs sorted by node_id, started time
- Next Commands: update_recipe_metrics
-
Execute:
- Select and lock applicable job models
- Check job status and exe_num to determine whether each job model should have full update (includes status), partial update (just node), or no update (since exe_num has increased)
- Do a partial update per node to set node field
- Do a single update to set status to RUNNING for all jobs that need a full update
- Send update_recipe_metrics messages for affected recipes
- Inputs: job_id, trigger_id, source_file_id, purge flag
- Next Commands: create_jobs
-
Execute:
- Get files produced by the input job_id
- Construct inputs for job comprised of a files dict, a workspaces dict, the purge flag, and the job_id
- Send create_jobs message to spawn
scale-delete-files
system job and give it the constructed inputs
- Inputs: Up to 100 recipe IDs, supersede timestamp, supersede_all flag, nodes names for superseded jobs, nodes names for superseded sub-recipes, unpublish_all flag, nodes names for jobs to unpublish, supersede_recursive_all flag, nodes names for sub-recipes to recursively supersede, unpublish_recursive_all flag, nodes names for sub-recipes to recursively supersede/unpublish
- Next Commands: cancel_jobs, unpublish_jobs, supersede_recipe_nodes
-
Execute:
- Supersede applicable jobs
- Supersede applicable sub-recipes
- Send cancel_jobs messages for superseded jobs
- Send unpublish_jobs messages for applicable jobs
- Send supersede_recipe_nodes messages to recursively handle sub-recipes
- Inputs: Up to 1000 job IDs, uncancel time
- Next Commands: update_recipe_metrics, update_recipe
-
Execute:
- Select and lock applicable job models
- Update applicable jobs to PENDING status
- Send update_recipe messages for all job IDs
- Send update_recipe_metrics messages for affected recipes
- Inputs: Up to 100 job IDs, unpublish time
- Next Commands: None
-
Execute:
- Mark all products produced by the given job IDs as unpublished
- Inputs: Up to 100 batch IDs
- Next Commands: None
-
Execute:
- Execute query to generate recipe metrics for the batch
- Execute query to generate job metrics for the batch
- Execute query to generate job metrics per job name for the batch
- Inputs: Up to 100 recipe IDs
- Next Commands: update_recipe, update_recipe_metrics, update_batch_metrics
-
Execute:
- Update the job and sub-recipe count metrics in the given recipe models
- Send update_recipe_metrics messages for recipes that contain this message's recipes
- Send update_recipe messages for root recipes that contain this message's recipes
- Send update_batch_metrics messages for batches associated with any top-level (not a sub-recipe) recipe updated by this message
- Inputs: Root recipe ID, forced nodes (optional)
- Next Commands: blocked_jobs, pending_jobs, create_jobs, create_recipes, process_job_input, process_recipe_input
-
Execute:
- Retrieve recipe with recipe type revision and recipe nodes
- Set the recipe as completed if all nodes have completed
- Create messages for jobs that need to be set to BLOCKED status
- Create messages for jobs that need to be set to PENDING status
- Create messages to create any needed recipe jobs
- Create messages to create any needed sub-recipes
- Create messages to process job input for jobs ready to be queued
- Create messages to process recipe input for sub-recipes ready to be processed
- NOTE: This message is deprecated. Please use update_recipe instead
- Inputs: Up to 100 recipe IDs
- Next Commands: blocked_jobs, pending_jobs, process_job_input
-
Execute:
- Lock applicable recipe models
- Process recipe handlers in batches, ensuring that each batch does not exceed 1000 jobs (unless a single recipe exceeds that on its own)
- Bulk create job and recipe_job models for recipe jobs that are ready to be created
- Create messages for recipe jobs that should be updated to BLOCKED/PENDING status
- For jobs ready for their input, set the job input from the recipe input and ancestor inputs
- Create process_job_input messages for jobs that are ready for first queue
- Set is_completed for newly completed recipes
- Home
- What's New
-
In-depth Topics
- Enable Scale to run CUDA GPU optimized algorithms
- Enable Scale to store secrets securely
- Test Scale's scan capability on the fly
- Test Scale's workspace broker capability on the fly
- Scale Performance Metrics
- Private docker repository configuration
- Setting up Automated Snapshots for Elasticsearch
- Setting up Cluster Monitoring
- Developer Notes