fluidml.task

class fluidml.task.TaskInfo(*, project_name, run_name, state=None, started=None, ended=None, duration=None, run_history=None, sweep_counter=None, unique_config_hash=None, id=None)[source]

Bases: BaseModel

A wrapper class to store important task information.

Used for serializing the information to the results store.

Parameters:
duration: Optional[timedelta]

The current running time of the task.

ended: Optional[datetime]

The end time of the task.

id: Optional[str]

A combination of the run-name and the sweep counter or unique config hash if the former does not exist.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'use_enum_values': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'duration': FieldInfo(annotation=Union[timedelta, NoneType], required=False), 'ended': FieldInfo(annotation=Union[datetime, NoneType], required=False), 'id': FieldInfo(annotation=Union[str, NoneType], required=False), 'project_name': FieldInfo(annotation=str, required=True), 'run_history': FieldInfo(annotation=Union[Dict, NoneType], required=False), 'run_name': FieldInfo(annotation=str, required=True), 'started': FieldInfo(annotation=Union[datetime, NoneType], required=False), 'state': FieldInfo(annotation=Union[TaskState, NoneType], required=False), 'sweep_counter': FieldInfo(annotation=Union[str, NoneType], required=False), 'unique_config_hash': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

project_name: str

Name of the project.

run_history: Optional[Dict]

Holds the task ids of all predecessor task including the task itself.

run_name: str

Name of the task’s current run.

started: Optional[datetime]

The start time of the task.

state: Optional[TaskState]

The current state of the task, e.g. “running”, “finished”, etc.

sweep_counter: Optional[str]

A dynamically created counter to distinguish different task instances with the same run name in the results store. E.g. used in the LocalFileStore to name run directories.

unique_config_hash: Optional[str]

An 8 character hash of the unique run config.

class fluidml.task.TaskState(value)[source]

Bases: str, Enum

The state of a task.

FAILED = 'failed'

Task failed due to an unexpected error.

FINISHED = 'finished'

Task finished successfully.

KILLED = 'killed'

Task has been killed by the user via KeyBoardInterrupt.

PENDING = 'pending'

Task has not been scheduled and processed, yet.

RUNNING = 'running'

Task is currently running.

SCHEDULED = 'scheduled'

Task has been scheduled for processing.

UPSTREAM_FAILED = 'upstream_failed'

Task failed/could not be executed due to one or more upstream task failures.