monkey_wrench.task.common module
The module which defines a function to read the tasks from a file.
- class monkey_wrench.task.common._AnyTask(*, document: ChimpRetrieve | Annotated[FetchFiles | VerifyFiles, FieldInfo(annotation=NoneType, required=True, discriminator='action')] | FetchIds)[source]
Bases:
BaseModel- document: Annotated[ChimpRetrieve | Annotated[FetchFiles | VerifyFiles, FieldInfo(annotation=NoneType, required=True, discriminator='action')] | FetchIds, FieldInfo(annotation=NoneType, required=True, discriminator='context')]
- monkey_wrench.task.common.read_tasks_from_file(filepath: ~typing.Annotated[~pathlib.Path, ~pydantic.types.PathType(path_type=file), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.<lambda>), ~pydantic.functional_validators.AfterValidator(func=~monkey_wrench.input_output._types.ensure_path_does_not_end_with_slash)]) Generator[Annotated[ChimpRetrieve | Annotated[FetchFiles | VerifyFiles, FieldInfo(annotation=NoneType, required=True, discriminator='action')] | FetchIds, FieldInfo(annotation=NoneType, required=True, discriminator='context')], None, None][source]
Read and parse task(s) from the given
.yamlfile.- Parameters:
filepath – The path of the YAML file to read the task(s) from. In case of multiple tasks in the same file, different tasks must be separated by three dashes
"---". In the language of YAML files, each task is essentially a document.- Yields:
A generator yielding the task(s) from the given YAML file.