alab_management.builders.samplebuilder module

alab_management.builders.samplebuilder module#

Build the sample object.

class SampleBuilder(name, experiment, tags=None, **metadata)[source]#

Bases: object

Build a sample.

Each sample has a name, tags, and metadata. Each sample also has a list of tasks which are binded to it. Each sample is a node in a directed graph of tasks. Each task has a list of samples which are binded to it. Each sample also has a list of tags and metadata. The tags and metadata are used to filter the samples and tasks. The tags and metadata are also used to group the samples and tasks.

add_task(task_id)[source]#

Add a task to the sample. You should use this function only for special cases which are not handled by the add_sample function.

Parameters:

task_id (str) – The object id of the task in mongodb

Return type:

None

Returns:

None.

property tasks#

Return the tasks binded to this sample.

to_dict()[source]#

Return Sample as a dictionary.

This looks like:

{
    "_id": str(ObjectId),
    "name": str,
    "tags": List[str],
    "metadata": Dict[str, Any],
}
Return type:

dict[str, Any]

Returns:

Dict[str, Any]: sample as a dictionary