jobflow_remote.jobs.data module#
- class jobflow_remote.jobs.data.DbCollection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- AUX = 'aux'#
- FLOWS = 'flows'#
- JOBS = 'jobs'#
- class jobflow_remote.jobs.data.DynamicResponseType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
Types of dynamic responses in jobflow.
- ADDITION = 'addition'#
- DETOUR = 'detour'#
- REPLACE = 'replace'#
- pydantic model jobflow_remote.jobs.data.FlowDoc[source]#
Bases:
BaseModel
Model for the standard representation of a Flow in the queue database.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "FlowDoc", "description": "Model for the standard representation of a Flow in the queue database.", "type": "object", "properties": { "uuid": { "title": "Uuid", "type": "string" }, "jobs": { "items": { "type": "string" }, "title": "Jobs", "type": "array" }, "state": { "$ref": "#/$defs/FlowState" }, "name": { "title": "Name", "type": "string" }, "lock_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Id" }, "lock_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Time" }, "created_on": { "format": "date-time", "title": "Created On", "type": "string" }, "updated_on": { "format": "date-time", "title": "Updated On", "type": "string" }, "metadata": { "title": "Metadata", "type": "object" }, "parents": { "additionalProperties": { "additionalProperties": { "items": { "type": "string" }, "type": "array" }, "type": "object" }, "title": "Parents", "type": "object" }, "ids": { "items": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "string" }, { "type": "string" }, { "type": "integer" } ], "type": "array" }, "title": "Ids", "type": "array" } }, "$defs": { "FlowState": { "description": "States of a Flow.", "enum": [ "WAITING", "READY", "RUNNING", "COMPLETED", "FAILED", "PAUSED", "STOPPED" ], "title": "FlowState", "type": "string" } }, "required": [ "uuid", "jobs", "state", "name" ] }
- Fields:
- as_db_dict() dict [source]#
Generate a dict representation suitable to be inserted in the database.
- Returns:
The dict representing the FlowDoc.
- Return type:
- property int_index_parents#
- pydantic model jobflow_remote.jobs.data.FlowInfo[source]#
Bases:
BaseModel
Model with information extracted from a FlowDoc. Mainly for visualization purposes.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "FlowInfo", "description": "Model with information extracted from a FlowDoc.\nMainly for visualization purposes.", "type": "object", "properties": { "db_ids": { "items": { "type": "string" }, "title": "Db Ids", "type": "array" }, "job_ids": { "items": { "type": "string" }, "title": "Job Ids", "type": "array" }, "job_indexes": { "items": { "type": "integer" }, "title": "Job Indexes", "type": "array" }, "flow_id": { "title": "Flow Id", "type": "string" }, "state": { "$ref": "#/$defs/FlowState" }, "name": { "title": "Name", "type": "string" }, "created_on": { "format": "date-time", "title": "Created On", "type": "string" }, "updated_on": { "format": "date-time", "title": "Updated On", "type": "string" }, "workers": { "items": { "type": "string" }, "title": "Workers", "type": "array" }, "job_states": { "items": { "$ref": "#/$defs/JobState" }, "title": "Job States", "type": "array" }, "job_names": { "items": { "type": "string" }, "title": "Job Names", "type": "array" }, "parents": { "items": { "items": { "type": "string" }, "type": "array" }, "title": "Parents", "type": "array" }, "hosts": { "items": { "items": { "type": "string" }, "type": "array" }, "title": "Hosts", "type": "array" } }, "$defs": { "FlowState": { "description": "States of a Flow.", "enum": [ "WAITING", "READY", "RUNNING", "COMPLETED", "FAILED", "PAUSED", "STOPPED" ], "title": "FlowState", "type": "string" }, "JobState": { "description": "States of a Job.", "enum": [ "WAITING", "READY", "CHECKED_OUT", "UPLOADED", "SUBMITTED", "RUNNING", "TERMINATED", "DOWNLOADED", "REMOTE_ERROR", "COMPLETED", "FAILED", "PAUSED", "STOPPED", "USER_STOPPED", "BATCH_SUBMITTED", "BATCH_RUNNING" ], "title": "JobState", "type": "string" } }, "required": [ "db_ids", "job_ids", "job_indexes", "flow_id", "state", "name", "created_on", "updated_on", "workers", "job_states", "job_names", "parents", "hosts" ] }
- Fields:
- pydantic model jobflow_remote.jobs.data.JobDoc[source]#
Bases:
BaseModel
Model for the standard representation of a Job in the queue database.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "JobDoc", "description": "Model for the standard representation of a Job in the queue database.", "type": "object", "properties": { "job": { "properties": { "@class": { "enum": [ "Job" ], "type": "string" }, "@module": { "enum": [ "jobflow.core.job" ], "type": "string" }, "@version": { "type": "string" } }, "required": [ "@class", "@module" ], "title": "Job", "type": "object" }, "uuid": { "title": "Uuid", "type": "string" }, "index": { "title": "Index", "type": "integer" }, "db_id": { "title": "Db Id", "type": "string" }, "worker": { "title": "Worker", "type": "string" }, "state": { "$ref": "#/$defs/JobState" }, "remote": { "$ref": "#/$defs/RemoteInfo", "default": { "step_attempts": 0, "queue_state": null, "process_id": null, "retry_time_limit": null, "error": null } }, "parents": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Parents" }, "previous_state": { "anyOf": [ { "$ref": "#/$defs/JobState" }, { "type": "null" } ], "default": null }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error" }, "lock_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Id" }, "lock_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Time" }, "run_dir": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Run Dir" }, "start_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Start Time" }, "end_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "End Time" }, "created_on": { "format": "date-time", "title": "Created On", "type": "string" }, "updated_on": { "format": "date-time", "title": "Updated On", "type": "string" }, "priority": { "default": 0, "title": "Priority", "type": "integer" }, "exec_config": { "anyOf": [ { "$ref": "#/$defs/ExecutionConfig" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Exec Config" }, "resources": { "anyOf": [ { "type": "object" }, { "properties": { "@class": { "enum": [ "QResources" ], "type": "string" }, "@module": { "enum": [ "qtoolkit.core.data_objects" ], "type": "string" }, "@version": { "type": "string" } }, "required": [ "@class", "@module" ], "type": "object" }, { "type": "null" } ], "default": null, "title": "Resources" }, "stored_data": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Stored Data" } }, "$defs": { "ExecutionConfig": { "additionalProperties": false, "description": "Configuration to be set before and after the execution of a Job.", "properties": { "modules": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "list of modules to be loaded", "title": "Modules" }, "export": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "description": "dictionary with variable to be exported", "title": "Export" }, "pre_run": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Other commands to be executed before the execution of a job", "title": "Pre Run" }, "post_run": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Commands to be executed after the execution of a job", "title": "Post Run" } }, "title": "ExecutionConfig", "type": "object" }, "JobState": { "description": "States of a Job.", "enum": [ "WAITING", "READY", "CHECKED_OUT", "UPLOADED", "SUBMITTED", "RUNNING", "TERMINATED", "DOWNLOADED", "REMOTE_ERROR", "COMPLETED", "FAILED", "PAUSED", "STOPPED", "USER_STOPPED", "BATCH_SUBMITTED", "BATCH_RUNNING" ], "title": "JobState", "type": "string" }, "RemoteInfo": { "description": "Model with data describing the remote state of a Job.", "properties": { "step_attempts": { "default": 0, "title": "Step Attempts", "type": "integer" }, "queue_state": { "anyOf": [ { "properties": { "@class": { "enum": [ "QState" ], "type": "string" }, "@module": { "enum": [ "qtoolkit.core.data_objects" ], "type": "string" }, "@version": { "type": "string" } }, "required": [ "@class", "@module" ], "type": "object" }, { "type": "null" } ], "default": null, "title": "Queue State" }, "process_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Process Id" }, "retry_time_limit": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retry Time Limit" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error" } }, "title": "RemoteInfo", "type": "object" } }, "required": [ "job", "uuid", "index", "db_id", "worker", "state" ] }
- Fields:
- field exec_config: ExecutionConfig | str | None = None#
- field job: Job [Required]#
- field remote: RemoteInfo = RemoteInfo(step_attempts=0, queue_state=None, process_id=None, retry_time_limit=None, error=None)#
- pydantic model jobflow_remote.jobs.data.JobInfo[source]#
Bases:
BaseModel
Model with information extracted from a JobDoc. Mainly for visualization purposes.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "JobInfo", "description": "Model with information extracted from a JobDoc.\nMainly for visualization purposes.", "type": "object", "properties": { "uuid": { "title": "Uuid", "type": "string" }, "index": { "title": "Index", "type": "integer" }, "db_id": { "title": "Db Id", "type": "string" }, "worker": { "title": "Worker", "type": "string" }, "name": { "title": "Name", "type": "string" }, "state": { "$ref": "#/$defs/JobState" }, "created_on": { "format": "date-time", "title": "Created On", "type": "string" }, "updated_on": { "format": "date-time", "title": "Updated On", "type": "string" }, "remote": { "$ref": "#/$defs/RemoteInfo", "default": { "step_attempts": 0, "queue_state": null, "process_id": null, "retry_time_limit": null, "error": null } }, "parents": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Parents" }, "previous_state": { "anyOf": [ { "$ref": "#/$defs/JobState" }, { "type": "null" } ], "default": null }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error" }, "lock_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Id" }, "lock_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Lock Time" }, "run_dir": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Run Dir" }, "start_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Start Time" }, "end_time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "End Time" }, "priority": { "default": 0, "title": "Priority", "type": "integer" }, "metadata": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Metadata" } }, "$defs": { "JobState": { "description": "States of a Job.", "enum": [ "WAITING", "READY", "CHECKED_OUT", "UPLOADED", "SUBMITTED", "RUNNING", "TERMINATED", "DOWNLOADED", "REMOTE_ERROR", "COMPLETED", "FAILED", "PAUSED", "STOPPED", "USER_STOPPED", "BATCH_SUBMITTED", "BATCH_RUNNING" ], "title": "JobState", "type": "string" }, "RemoteInfo": { "description": "Model with data describing the remote state of a Job.", "properties": { "step_attempts": { "default": 0, "title": "Step Attempts", "type": "integer" }, "queue_state": { "anyOf": [ { "properties": { "@class": { "enum": [ "QState" ], "type": "string" }, "@module": { "enum": [ "qtoolkit.core.data_objects" ], "type": "string" }, "@version": { "type": "string" } }, "required": [ "@class", "@module" ], "type": "object" }, { "type": "null" } ], "default": null, "title": "Queue State" }, "process_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Process Id" }, "retry_time_limit": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retry Time Limit" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error" } }, "title": "RemoteInfo", "type": "object" } }, "required": [ "uuid", "index", "db_id", "worker", "name", "state", "created_on", "updated_on" ] }
- Fields:
- field remote: RemoteInfo = RemoteInfo(step_attempts=0, queue_state=None, process_id=None, retry_time_limit=None, error=None)#
- classmethod from_query_output(d) JobInfo [source]#
Generate an instance from the output of a query to the JobDoc collection.
- Parameters:
d – The dictionary with the queried data.
- Returns:
The instance of JobInfo based on the data
- Return type:
- exception jobflow_remote.jobs.data.RemoteError(msg, no_retry=False)[source]#
Bases:
RuntimeError
An exception signaling errors during the update of the remote states.
- pydantic model jobflow_remote.jobs.data.RemoteInfo[source]#
Bases:
BaseModel
Model with data describing the remote state of a Job.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "RemoteInfo", "description": "Model with data describing the remote state of a Job.", "type": "object", "properties": { "step_attempts": { "default": 0, "title": "Step Attempts", "type": "integer" }, "queue_state": { "anyOf": [ { "properties": { "@class": { "enum": [ "QState" ], "type": "string" }, "@module": { "enum": [ "qtoolkit.core.data_objects" ], "type": "string" }, "@version": { "type": "string" } }, "required": [ "@class", "@module" ], "type": "object" }, { "type": "null" } ], "default": null, "title": "Queue State" }, "process_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Process Id" }, "retry_time_limit": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retry Time Limit" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Error" } } }
- Fields:
- jobflow_remote.jobs.data.get_initial_flow_doc_dict(flow: Flow, job_dicts: list[dict]) dict [source]#
Generate a serialized FlowDoc for initial insertion in the DB.
- Parameters:
flow – The Flow used to generate the FlowDoc.
job_dicts – The dictionaries of the Jobs composing the Flow.
- Returns:
A serialized version of a new FlowDoc.
- Return type:
- jobflow_remote.jobs.data.get_initial_job_doc_dict(job: Job, parents: list[str] | None, db_id: str, worker: str, exec_config: ExecutionConfig | None, resources: dict | QResources | None) dict [source]#
Generate an instance of JobDoc for initial insertion in the DB.
- Parameters:
job – The Job of the JobDoc.
parents – The parents of the Job.
db_id – The db_id.
worker – The worker where the Job should be executed.
exec_config – The ExecutionConfig used for execution.
resources – The resources used to run the Job.
- Returns:
A new JobDoc.
- Return type: