libmuscle.manager.instantiator module

class libmuscle.manager.instantiator.CancelAllRequest[source]

Bases: InstantiatorRequest

Requests stopping all running processes.

class libmuscle.manager.instantiator.CrashedResult(exception: BaseException | None = None)[source]

Bases: object

Signals that the instantiator process crashed.

class libmuscle.manager.instantiator.InstantiationRequest(instance: Reference, program: Program, res_req: ResourceRequirements, resources: ResourceAssignment, instance_dir: Path, work_dir: Path, stdout_path: Path, stderr_path: Path)[source]

Bases: InstantiatorRequest

Requests instantiating a new process.

instance

The name of the instance

program

The program to start for it

res_req

The resource requirements for this instance

resources

The specific resources to start it on

instance_dir

The main directory for this instance

work_dir

The directory in which to start it

stdout_path

Path of file to redirect stdout to

stderr_path

Path of file to redirect stderr to

class libmuscle.manager.instantiator.InstantiatorRequest[source]

Bases: object

Base class for requests to an instantiator.

class libmuscle.manager.instantiator.Process(instance: Reference, resources: ResourceAssignment)[source]

Bases: object

Represents a process.

instance

Name of instance this is the process of

resources

The resources allocated to this process

status

Current status of the process

exit_code

Exit code, if status is ERROR

error_msg

Error message, if status is ERROR

class libmuscle.manager.instantiator.ProcessStatus(*values)[source]

Bases: Enum

Status of a process (instance).

CANCELED = 4
ERROR = 3
RUNNING = 1
STARTED = 0
SUCCESS = 2
is_finished() bool[source]

Returns whether the job is finished.

Canceled jobs are considered finished, even if they’ve never run.

class libmuscle.manager.instantiator.QueueingLogHandler(queue: Queue)[source]

Bases: Handler

A logging Handler that enqueues records.

emit(record: LogRecord) None[source]

Emit the record by enqueueing it.

Parameters:

record – A log record to enqueue.

class libmuscle.manager.instantiator.ShutdownRequest[source]

Bases: InstantiatorRequest

Requests shutting down the background process.

The process will stop once all running processes are done.

libmuscle.manager.instantiator.create_instance_env(instance: Reference, base_env: BaseEnv, overlay: Dict[str, str]) Dict[str, str][source]

Creates an environment for an instance.

This takes the current (manager) environment variables and makes a copy, then adds or extends it according to the overlay given.

Keys from overlay that start with + will have the corresponding value appended to the matching (by key, without the +) value in env, otherwise the value in env gets overwritten.

libmuscle.manager.instantiator.reconfigure_logging(queue: Queue) None[source]

Reconfigure logging to send to queue.

This reconfigures the logging subsystem to intercept all log messages and send them to the given queue, rather than to the previously configured handler.