libmuscle.util module

libmuscle.util.extract_log_file_location(filename: str) Optional[pathlib.Path][source]

Gets the log file location from the command line.

Extracts the –muscle-log-file=<path> argument to tell the MUSCLE library where to write the local log file. This function will extract this argument from the command line arguments if it is present. If the given path is to a directory, <filename> will be written inside of that directory, if the path is not an existing directory, then it will be used as the name of the log file to write to. If no command line argument is given, this function returns None.

Parameters

filename – Default file name to use.

Returns

Path to the log file to write.

libmuscle.util.generate_indices(dims: List[int]) Generator[List[int], None, None][source]

Generates all indices in a block of the given dimensions.

Parameters

dims – The dimensions of the block.

Yields

Lists of indices, one for each point in the block.

libmuscle.util.increment_index(index: List[int], dims: List[int]) bool[source]

Increments an index.

Parameters
  • index – The index to be incremented.

  • dims – The dimensions of the block this index is in.

Returns

True iff the index overflowed and is now all zeros again.

libmuscle.util.instance_indices(instance: ymmsl.identity.Reference) List[int][source]

Extracts the indices from an instance name.

Parameters

instance – The name of a kernel instance.

Returns

The name of its kernel.

libmuscle.util.instance_to_kernel(instance: ymmsl.identity.Reference) ymmsl.identity.Reference[source]

Extracts the name of the kernel from an instance name.

Parameters

instance – The name of a kernel instance.

Returns

The name of its kernel.