laboneq.workflow.logbook.folder_store
¶
Implementation of logbook which stores data in a folder.
ArtifactFiles()
¶
A record of files opened for an artifact.
add(filename, description=None)
¶
Add the specified file to the list of opened files.
as_dicts()
¶
Return a list of dictionaries describing the opened files.
The returned dictionaries consist of:
{
"filename": <filename>,
"description": <description>,
}
The description is omitted if none was supplied by the
serializer.
FolderLogbook(folder, serialize, save_mode)
¶
Bases: Logbook
A logbook that stores a workflow's results and artifacts in a folder.
comment(message)
¶
Called to leave a comment.
log(level, message, *args)
¶
Called to leave a log message.
on_end(workflow_result)
¶
Called when the workflow execution ends.
on_error(workflow_result, error)
¶
Called when the workflow raises an exception.
on_start(workflow_result)
¶
Called when the workflow execution starts.
on_task_end(task)
¶
Called when a task ends execution.
on_task_error(task, error)
¶
Called when a task raises an exception.
on_task_start(task)
¶
Called when a task begins execution.
save(artifact)
¶
Called to save an artifact.
FolderLogbookOpener(logbook, artifact_name, serializer_options)
¶
Bases: SerializeOpener
A serialization file opener for the FolderStore and FolderLogbook.
Files are opened in the logbook folder with the base filename being
{artifact_name}-{suffix}.{ext}. The dash is omitted if the suffix
is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logbook
|
FolderLogbook
|
The logbook files will be opened for. |
required |
artifact_name
|
str
|
The name of the artifact being serialized. |
required |
serializer_options
|
SimpleDict
|
The options for the serializer. |
required |
FolderStore(folder, serialize=None, *, save_mode=SaveMode.WARN)
¶
Bases: LogbookStore
A folder-based store that stores workflow results and artifacts in a folder.
The store produces an log file .jsonl, and in some cases external files.
An external file is generated when an object to be saved is too large to
fit nicely into the log file, and when it happens, the logfile will have a
reference pointing into the file the data was saved to.
For tasks which are marked as not to be saved, their inputs and outputs are omitted from logfiles and from generating any external files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
Path | str
|
The root path for the folder store. |
required |
serialize
|
Callable | None
|
The folder store serializer to use. It defaults to
|
None
|
save_mode
|
str | SaveMode
|
Controls whether the folder store saves task and workflow inputs and outputs and whether a warning is logged or an error is raised when an unsupported input or output is encountered. |
WARN
|
create_logbook(workflow, start_time)
¶
Create a new logbook for the given workflow.
SaveMode
¶
Bases: Enum
An enumeration for specifying how task inputs and outputs are saved.
The modes are:
- WARN:
The inputs and outputs are saved when possible. If
unsupported types which cannot be saved are encountered,
a warning message is logged.
- RAISE:
The input and outputs are always saved. If
unsupported types which cannot be saved are encountered,
an exception is raised.
- SKIP:
The task and workflow inputs and outputs are not saved.