jobflow_remote.jobs.data module#
- class jobflow_remote.jobs.data.BatchDoc(*, batch_uid: str, process_id: str, batch_state: BatchState, worker: str, jobs: list = <factory>, created_on: datetime = <factory>, updated_on: datetime = <factory>, start_time: datetime | None = None, end_time: datetime | None = None, last_ping_time: datetime | None = None)[source]#
Bases:
BaseModelModel for the standard representation of a batch process in the batch 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.
- as_db_dict() dict[source]#
Generate a dict representation suitable to be inserted in the database.
- Returns:
The dict representing the BatchDoc.
- Return type:
- batch_state: BatchState#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jobflow_remote.jobs.data.DbCollection(value)[source]#
Bases:
Enum- AUX = 'aux'#
- FLOWS = 'flows'#
- JOBS = 'jobs'#
- class jobflow_remote.jobs.data.DynamicResponseType(value)[source]#
Bases:
EnumTypes of dynamic responses in jobflow.
- ADDITION = 'addition'#
- DETOUR = 'detour'#
- REPLACE = 'replace'#
- class jobflow_remote.jobs.data.FlowDoc(*, uuid: str, jobs: list[str], state: ~jobflow_remote.jobs.state.FlowState, name: str, lock_id: str | None = None, lock_time: ~datetime.datetime | None = None, created_on: ~datetime.datetime = <factory>, updated_on: ~datetime.datetime = <factory>, metadata: dict = <factory>, parents: dict[str, dict[str, list[str]]] = <factory>, ids: list[tuple[str, str, int]] = <factory>, jobstore: str | None = None)[source]#
Bases:
BaseModelModel 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.
- 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#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jobflow_remote.jobs.data.FlowInfo(*, db_ids: list[str], job_ids: list[str], job_indexes: list[int], flow_id: str, state: FlowState, name: str, created_on: datetime, updated_on: datetime, workers: list[str], job_states: list[JobState], job_names: list[str], parents: list[list[str]], hosts: list[list[str]], flow_metadata: dict, jobs_info: list[JobInfo] | None = None)[source]#
Bases:
BaseModelModel 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.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jobflow_remote.jobs.data.JobDoc(*, job: Job, uuid: str, index: int, db_id: str, worker: str, state: JobState, remote: RemoteInfo = RemoteInfo(step_attempts=0, queue_state=None, process_id=None, retry_time_limit=None, error=None, prerun_cleanup=False, queue_out=None, queue_err=None), parents: list[str] | None = None, previous_state: JobState | None = None, error: str | None = None, lock_id: str | None = None, lock_time: datetime | None = None, run_dir: str | None = None, start_time: datetime | None = None, end_time: datetime | None = None, created_on: datetime = <factory>, updated_on: datetime = <factory>, priority: int = 0, exec_config: ExecutionConfig | str | None = None, resources: QResources | dict | None = None, stored_data: dict | None = None)[source]#
Bases:
BaseModelModel 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.
- as_db_dict() dict[source]#
Generate a dict representation suitable to be inserted in the database.
- Returns:
The dict representing the JobDoc.
- Return type:
- exec_config: ExecutionConfig | str | None#
- job: Job#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- remote: RemoteInfo#
- class jobflow_remote.jobs.data.JobInfo(*, uuid: str, index: int, db_id: str, worker: str, name: str, state: JobState, created_on: datetime, updated_on: datetime, remote: RemoteInfo = RemoteInfo(step_attempts=0, queue_state=None, process_id=None, retry_time_limit=None, error=None, prerun_cleanup=False, queue_out=None, queue_err=None), parents: list[str] | None = None, previous_state: JobState | None = None, error: str | None = None, lock_id: str | None = None, lock_time: datetime | None = None, run_dir: str | None = None, start_time: datetime | None = None, end_time: datetime | None = None, priority: int = 0, metadata: dict | None = None, stored_data: dict | None = None, hosts: list[str] | None = None)[source]#
Bases:
BaseModelModel 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.
- property estimated_run_time: float | None#
Estimate the current run time based on the start time and the current time.
- Returns:
The estimated run time in seconds.
- Return type:
- 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:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- remote: RemoteInfo#
- exception jobflow_remote.jobs.data.RemoteError(msg, no_retry=False)[source]#
Bases:
RuntimeErrorAn exception signaling errors during the update of the remote states.
- class jobflow_remote.jobs.data.RemoteInfo(*, step_attempts: int = 0, queue_state: QState | None = None, process_id: str | None = None, retry_time_limit: datetime | None = None, error: str | None = None, prerun_cleanup: bool = False, queue_out: str | None = None, queue_err: str | None = None)[source]#
Bases:
BaseModelModel 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.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- jobflow_remote.jobs.data.get_initial_batch_doc_dict(batch_uid, process_id, worker)[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.
jobstore – The name of the JobStore used for the output of the submitted Flow. If None the default is used.
- Returns:
A serialized version of a new FlowDoc.
- Return type:
- jobflow_remote.jobs.data.get_initial_flow_doc_dict(flow: Flow, job_dicts: list[dict], jobstore: str | None = None) 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.
jobstore – The name of the JobStore used for the output of the submitted Flow. If None the default is used.
- 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, priority: int) 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.
priority – The priority of the Job.
- Returns:
A new JobDoc.
- Return type: