API Reference: Entity Types

Contents

API Reference: Entity Types#

Complete reference for all B-Fabric entity types.

class bfabric.entities.core.entity.Entity(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: FindMixin

A single generic entity, read from B-Fabric.

ENDPOINT() str#
property bfabric_instance: str#

The bfabric instance URL associated with the entity.

property classname: str#

The entity’s classname.

property custom_attributes: dict[str, str]#

Returns custom attributes as a dictionary, if the entity has any.

If the field exists but is empty, an empty dictionary is returned. If the field does not exist, an AttributeError is raised.

property data_dict: ApiResponseObjectType#

Returns a shallow copy of the entity’s data dictionary.

dump_yaml(path: Path) None#

Writes the entity’s data dictionary to a YAML file.

get(key: str, default: Any = None) ApiResponseDataType | None#

Returns the value of a key in the data dictionary, or a default value if the key is not present.

property id: int#

Returns the entity’s ID.

classmethod load_yaml(path: Path, client: Bfabric | None = None, bfabric_instance: str | None = None) Self#

Loads an entity from a YAML file.

property refs: References#

Returns the entity’s references manager.

property uri: EntityUri#

The entity’s URI.

property web_url: str#
class bfabric.entities.Application(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'application'#
executable: HasOne[Executable]#
storage: HasOne[Storage]#
property technology_folder_name: Annotated[str, BeforeValidator(func=path_safe_name, json_schema_input_type=PydanticUndefined)]#

Returns the technology which is used e.g. for output registration.

Currently, in case of multiple technologies, the first one (alphabetically) is used. TODO this logic should probably be improved in the future

class bfabric.entities.Dataset(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

Representation of a single dataset in B-Fabric.

ENDPOINT: str = 'dataset'#
property column_names: list[str]#

Returns a list of column names in the dataset.

property column_types: dict[str, str]#

Returns a dictionary mapping column names to their data types.

get_csv(separator: str = ',') str#

Returns the dataset as a csv string, using the specified column separator.

get_parquet() bytes#

Returns the dataset as a parquet bytes object.

to_polars() DataFrame#

Returns a Polars DataFrame representation of the dataset.

write_csv(path: Path, separator: str = ',') None#

Writes the dataset to a csv file at path, using the specified column separator.

write_parquet(path: Path) None#

Writes the dataset to a parquet file at path.

class bfabric.entities.Executable(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'executable'#
property decoded: str | None#
property decoded_bytes: bytes | None#
property decoded_str: str | None#
parameters: HasMany[Parameter]#
storage#
class bfabric.entities.ExternalJob(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'externaljob'#
property client_entity: Entity | None#
executable: HasOne[Executable]#
property workunit: Workunit | None#
class bfabric.entities.Instrument(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'instrument'#
class bfabric.entities.MultiplexId(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'multiplexid'#
class bfabric.entities.MultiplexKit(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'multiplexkit'#
property ids: DataFrame#
multiplex_ids: HasMany[MultiplexId]#
class bfabric.entities.Order(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'order'#
project: HasOne[Project]#
class bfabric.entities.Parameter(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'parameter'#
property key: str#
property value: str#
class bfabric.entities.Plate(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'plate'#
class bfabric.entities.Project(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'project'#
class bfabric.entities.Resource(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'resource'#
property filename: str#

Returns the filename of the actual path, i.e. not necessarily the resource name but rather the name as the file is stored.

sample: HasOne[Sample]#
storage: HasOne[Storage]#
property storage_absolute_path: Path#

Returns the absolute path of the resource in the storage as a Path object.

property storage_relative_path: Path#

Returns the relative path of the resource in the storage as a Path object.

workunit: HasOne[Workunit]#
class bfabric.entities.Run(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'run'#
class bfabric.entities.Sample(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'sample'#
container: HasOne[Order | Project]#
class bfabric.entities.Storage(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'storage'#
property base_path: Path#
property scp_prefix: str | None#

SCP prefix with storage base path included.

class bfabric.entities.User(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity

ENDPOINT = 'user'#
classmethod find_by_login(login: str, client: Bfabric) User | None#

Finds a user by their login name.

class bfabric.entities.Workflow(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity, UserCreatedMixin

ENDPOINT = 'workflow'#
container: HasOne[Order | Project]#
workflow_steps: HasMany[WorkflowStep]#
workflow_template: HasOne[WorkflowTemplate]#
class bfabric.entities.WorkflowStep(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity, UserCreatedMixin

ENDPOINT = 'workflowstep'#
container: HasOne[Order | Project]#
class bfabric.entities.WorkflowTemplate(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity, UserCreatedMixin

ENDPOINT = 'workflowtemplate'#
workflow_template_steps: HasMany[WorkflowTemplateStep]#
class bfabric.entities.WorkflowTemplateStep(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity, UserCreatedMixin

ENDPOINT = 'workflowtemplatestep'#
workflow_template: HasOne[WorkflowTemplate]#
class bfabric.entities.Workunit(data_dict: ApiResponseObjectType, client: Bfabric | None = None, bfabric_instance: str | None = None)#

Bases: Entity, UserCreatedMixin

Immutable representation of a single workunit in B-Fabric.

ENDPOINT = 'workunit'#
application: HasOne[Application]#
property application_parameters: dict[str, str]#

Dictionary of application context parameters.

container: HasOne[Order | Project]#
external_jobs: HasMany[ExternalJob]#
input_dataset: HasOne[Dataset]#
input_resources: HasMany[Resource]#
property parameter_values: dict[str, str]#
parameters: HasMany[Parameter]#
resources: HasMany[Resource]#
property store_output_folder: Path#

Relative path in the storage for the workunit output.

property submitter_parameters: dict[str, str]#

Dictionary of submitter context parameters.

property workunit_parameters: dict[str, str]#

Dictionary of workunit context parameters.

See Also#