sio3pack.workflow.execution¶
Package Contents¶
- class sio3pack.workflow.execution.Channel(buffer_size, source_pipe, target_pipe, file_buffer_size=None, limit=None)[source]¶
- A configuration of a channel. A channel is a connection between two pipes. - Parameters:
- buffer_size (int) – The maximum amount of data stored in the channel that has been written by the writer, but not yet read by the reader. This value must be positive. 
- source_pipe (int) – The pipe this channel will be reading from. 
- target_pipe (int) – The pipe this channel will be writing to. 
- file_buffer_size (int) – Controls whether this channel is backed by a file on the disk. A larger buffer may then be allocated on the disk. 
- limit (int) – Limits the maximum amount of data sent through the channel. 
 
 
- class sio3pack.workflow.execution.DescriptorManager(objects_manager, filesystem_manager)[source]¶
- A class to manage file descriptors and their associated streams. - Parameters:
- objects_manager (ObjectsManager) – The objects manager. 
- filesystem_manager (FilesystemManager) – The filesystem manager. 
 
 - from_json(data)[source]¶
- Load the descriptor manager from a JSON-serializable dictionary. - Parameters:
- data (dict) – The JSON-serializable dictionary to load from. 
 
 - items()[source]¶
- Get the items in the descriptor manager. - Returns:
- A view of the descriptor manager’s items. 
- Return type:
- ItemsView[int, sio3pack.workflow.execution.stream.Stream] 
 
 
- class sio3pack.workflow.execution.EmptyFilesystem(id=None)[source]¶
- Bases: - Filesystem- A base class to represent a filesystem. - Parameters:
- id (int) – The id of the filesystem in the task. 
 
- class sio3pack.workflow.execution.Filesystem(id=None)[source]¶
- A base class to represent a filesystem. - Parameters:
- id (int) – The id of the filesystem in the task. 
 
- class sio3pack.workflow.execution.FilesystemManager(task)[source]¶
- A class to manage filesystems. - Parameters:
- task (Task) – The task the filesystem manager belongs to. 
- filesystems (list[Filesystem]) – The list of filesystems. 
 
 - get_by_id(id)[source]¶
- Get a filesystem by id. :param id: The id of the filesystem. - Parameters:
- id (int) 
- Return type:
 
 - add(filesystem)[source]¶
- Add a filesystem to the manager. :param filesystem: The filesystem to add. - Parameters:
- filesystem (Filesystem) 
 
 
- class sio3pack.workflow.execution.ImageFilesystem(image, path=None, id=None)[source]¶
- Bases: - Filesystem- A class to represent an image filesystem. An image can be for example a g++ compilator, a python interpreter, etc. - Parameters:
 
- class sio3pack.workflow.execution.ObjectFilesystem(object, id=None)[source]¶
- Bases: - Filesystem- A base class to represent a filesystem. - Parameters:
- id (int) – The id of the filesystem in the task. 
- object (sio3pack.workflow.object.Object) 
 
 
- class sio3pack.workflow.execution.MountNamespace(mountpoints=None, root=0, id=None)[source]¶
- A class to represent a mount namespace. It can mount - Mountpointinstances in the target filesystem.- Parameters:
- id (int) – The id of the mount namespace. 
- mountpoints (list[Mountpoint]) – The mountpoints in the mount namespace. 
- root (int) 
 
 - classmethod from_json(data, id, filesystem_manager)[source]¶
- Create a new mount namespace from a dictionary. :param data: The dictionary to create the mount namespace from. :param id: The id of the mount namespace. :param filesystem_manager: The filesystem manager to use. 
 - add_mountpoint(mountpoint)[source]¶
- Add a mountpoint to the mount namespace. - Parameters:
- mountpoint (Mountpoint) – The mountpoint to add. 
 
 
- class sio3pack.workflow.execution.MountNamespaceManager(task, filesystem_manager)[source]¶
- Parameters:
- task (Task) 
- filesystem_manager (sio3pack.workflow.execution.filesystems.FilesystemManager) 
 
 - add(mount_namespace)[source]¶
- Add a mount namespace to the manager. - Parameters:
- mount_namespace (MountNamespace) – The mount namespace to add. 
 
 
- class sio3pack.workflow.execution.Mountpoint(source, target, writable=False, capacity=None)[source]¶
- A class to represent a mountpoint. - Parameters:
 - classmethod from_json(data, filesystem_manager)[source]¶
- Create a new mountpoint from a dictionary. - Parameters:
- data (dict) – The dictionary to create the mountpoint from. 
- filesystem_manager (FilesystemManager) – The filesystem manager to use. 
 
- Return type:
 
 
- class sio3pack.workflow.execution.Process(workflow, task, arguments=None, environment=None, image='', mount_namespace=None, resource_group=None, pid_namespace=0, working_directory='/', start_after=None)[source]¶
- A class to represent a process in a workflow. - Parameters:
- workflow (Workflow) – The workflow the process belongs to. 
- task (Executiontask) – The task which the process belongs to. 
- arguments (list[str]) – Executable arguments for the process. 
- environment (dict) – Environment variables for the process. 
- image (str) – The image of the process, which can be a Docker image or similar. 
- mount_namespace (MountNamespace) – The mount namespace to use for the process. 
- resource_group (ResourceGroup) – The resource group of the process. 
- working_directory (str) – The working directory of the process. 
- pid_namespace (int) – The PID namespace of the process. 
- start_after (list[int]) – The processes that must be finished before this process starts. 
- environment 
 
 
- class sio3pack.workflow.execution.ResourceGroup(cpu_usage_limit=100.0, instruction_limit=1000000000.0, memory_limit=2147483648, oom_terminate_all_tasks=False, pid_limit=2, swap_limit=0, time_limit=1000000000.0, id=None)[source]¶
- A resource group is a set of limits that can be applied to a task. It can limit CPU usage, instruction usage, memory usage, and more. - Parameters:
- id (int) – The id of the resource group. 
- cpu_usage_limit (int) – The CPU usage limit. 
- instruction_limit (int) – The instruction usage limit. 
- memory_limit (int) – The memory limit. 
- oom_terminate_all_tasks (bool) – Whether to terminate all tasks on OOM. 
- pid_limit (int) – The PID limit. 
- swap_limit (int) – The swap limit. 
- time_limit (int) – The time limit. 
 
 - set_limits(cpu_usage_limit, instruction_limit, memory_limit, time_limit)[source]¶
- Set the limits of the resource group. 
 
- class sio3pack.workflow.execution.ResourceGroupManager(task)[source]¶
- A class to manage resource groups in a workflow. Allows creation, retrieval, and management of resource groups. - Parameters:
- task (Task) 
 - add(resource_group)[source]¶
- Add a resource group to the resource group manager. - Parameters:
- resource_group (ResourceGroup) – The resource group to add. 
 
 - get_by_id(id)[source]¶
- Get a resource group by its id. - Parameters:
- id (int) – The id of the resource group to get. 
- Return type:
 
 
- class sio3pack.workflow.execution.FileMode(*args, **kwds)[source]¶
- Bases: - enum.Enum- Enum representing the mode of a file stream. 
- class sio3pack.workflow.execution.FileStream(filesystem, path, mode)[source]¶
- Bases: - Stream- Class representing a file stream. A file will be opened and passed to the process as a file descriptor. - Parameters:
- filesystem (Filesystem) – The filesystem to use. 
- path (str) – The path to the file. 
- mode (FileMode) – The mode to open the file in. 
 
 - classmethod from_json(filesystem_manager, data)[source]¶
- Create a file stream from a JSON-serializable dictionary. - Parameters:
- filesystem_manager (FilesystemManager) – The filesystem manager. 
- data (dict) – The JSON-serializable dictionary to create the file stream from. 
 
- Return type:
 
 
- class sio3pack.workflow.execution.NullStream[source]¶
- Bases: - Stream- Class representing a null stream. 
- class sio3pack.workflow.execution.ObjectReadStream(object)[source]¶
- Bases: - ObjectStream- Class representing an object read stream. An object read stream is a stream that reads from an object via a file descriptor. - Parameters:
- object (Object) – The object to read from. 
 
- class sio3pack.workflow.execution.ObjectStream(type, object)[source]¶
- Bases: - Stream- A base class for object streams. An object stream is a stream that reads or writes to an object via a file descriptor. - Parameters:
- type (StreamType) – The type of the stream. 
- object (Object) – The object to use. 
 
 
- class sio3pack.workflow.execution.ObjectWriteStream(object)[source]¶
- Bases: - ObjectStream- Class representing an object write stream. An object write stream is a stream that writes to an object via a file descriptor. - Parameters:
- object (Object) – The object to write to. 
 
- class sio3pack.workflow.execution.PipeReadStream(pipe_index)[source]¶
- Bases: - PipeStream- Class representing a pipe read stream. A pipe read stream is a stream that reads from a pipe via a file descriptor. - Parameters:
- pipe_index (int) – The index of the pipe. 
 
- class sio3pack.workflow.execution.PipeStream(type, pipe_index)[source]¶
- Bases: - Stream- A base class for pipe streams. A pipe stream is a stream that reads or writes to a pipe via a file descriptor. - Parameters:
- type (StreamType) – The type of the stream. 
- pipe_index (int) – The index of the pipe. 
 
 
- class sio3pack.workflow.execution.PipeWriteStream(pipe_index)[source]¶
- Bases: - PipeStream- Class representing a pipe write stream. A pipe write stream is a stream that writes to a pipe via a file descriptor. - Parameters:
- pipe_index (int) – The index of the pipe. 
 
- class sio3pack.workflow.execution.Stream(type)[source]¶
- Base class for all streams. - Parameters:
- type (StreamType) – The type of the stream. 
 - classmethod from_json(data, objects_manager, filesystem_manager)[source]¶
- Create a stream from a JSON-serializable dictionary. - Parameters:
- data (dict) – The JSON-serializable dictionary to create the stream from. 
- objects_manager (ObjectsManager) – The objects manager. 
- filesystem_manager (FilesystemManager) – The filesystem manager. 
 
- Return type: