api Package

api Package

This module provides the API for fastr that users should use. This API will be considered stable between major versions. If users only interact via this API (and refrain from operating on parent attributes), their code should be compatible within major version of fastr.

fastr.api.create_network(id, version=None)[source]

Create a new Network object

  • id (str) – id of the network
  • version (Union[Version, str, None]) – version of the network
Return type:




Create a network based on another Network state. The network state can be a Network or the state gotten from a Network with __getstate__.

Parameters:network_state (Union[Network, Network, dict]) – Network (state) to create a copy of
Return type:Network
Returns:The rebuilt network
class fastr.api.ResourceLimit(cores=1, memory='2G', time='01:00:00')[source]

Bases: object


Check if two resource limits are equal

Parameters:other – resource limit to test against
Return type:bool
Return type:dict
__hash__ = None
__init__(cores=1, memory='2G', time='01:00:00')[source]

An object describing resource requirements/limits for a node

  • cores (Optional[int]) – number of cores
  • memory (Union[str, int, None]) – memory specification, can be int with number of megabytes or a string with numbers ending on M, G, T, P for megabytes, gigabytes, terrabytes or petabytes. Note that the number has to be an integer, e.g. 1500M would work, whereas 1.5G would be invalid
  • time (Union[str, int, None]) – run time specification, this can be an int with the number of seconds or a string in the HH:MM:SS, MM:SS, or SS format. Where HH, MM, and SS are integers representing the number of hours, minutes and seconds.
__module__ = 'fastr.core.resourcelimit'

Check if two resource limits are not equal

Parameters:other – resource limit to test against
Return type:bool
__slots__ = ('_cores', '_memory', '_time')

Return a copy of current resource limit object

Return type:ResourceLimit

The required number of gpus

Return type:int

The required memory in megabytes

Return type:int

The required time in seconds

Return type:int