StepInfo#

class tango.step_info.StepInfo(unique_id, step_class_name, dependencies, cacheable, step_name=None, version=None, start_time=None, end_time=None, error=None, result_location=None, config=None, metadata=None, platform=<factory>, environment=<factory>)[source]#

Stores step information without being the Step itself.

It’s not always possible to get a Step object, because Step objects can’t be serialized. But you can always serialize a StepInfo object.

unique_id: str#

The unique ID of the step

step_class_name: str#

The name of the Step class

dependencies: Set[str]#

The unique ids of all the steps that this step depends on

cacheable: bool#

Whether or not the step is cacheable.

step_name: Optional[str] = None#

The name of the step, if it has one. Anonymous steps are identified only by their unique ID.

The same step can have different names in different runs. The last run wins, so don’t rely on this property in your code. It is just here to aid readability.

version: Optional[str] = None#

The version string of the Step, if it has one.

start_time: Optional[datetime] = None#

The time (in UTC) that this step started running.

See also

start_time_local().

end_time: Optional[datetime] = None#

The time (in UTC) that this step stopped running. This will be set whether the step succeeded or failed.

See also

end_time_local().

error: Optional[str] = None#

If the step failed, this is where the error goes.

Note

Some Workspace implementations need to serialize StepInfo (using pickle or dill, for example), but some exceptions can’t be pickled. In those cases error will just be a string representation of the exception.

result_location: Optional[str] = None#

Location of the result. This could be a path or a URL.

config: Optional[Dict[str, Any]] = None#

The raw config of the step.

metadata: Optional[Dict[str, Any]] = None#

Metadata from the step. This comes from the step_metadata argument to the Step class.

platform: PlatformMetadata#

The PlatformMetadata.

environment: EnvironmentMetadata#

The EnvironmentMetadata.

property start_time_local: Optional[datetime]#

The time the step started running with respect to the local timezone, if the timezone can be determined.

property end_time_local: Optional[datetime]#

The time the step stopped running with respect to the local timezone, if the timezone can be determined.

property duration: Optional[timedelta]#

The time it took to run this step.

property state: StepState#

Returns the state of the step

to_json_dict()[source]#

Generates a JSON-safe, human-readable, dictionary representation of this dataclass.

Return type:

Dict[str, Any]

classmethod from_json_dict(json_dict)[source]#

The inverse of to_json_dict().

Parameters:

json_dict (Dict[str, Any]) – A dictionary representation, such as the one produced by to_json_dict().

Return type:

StepInfo

refresh()[source]#

Refresh environment and platform metadata.

class tango.step_info.StepState(value)[source]#

Describes the possible state a step can be in.

INCOMPLETE = 'incomplete'#

The step has not run yet.

RUNNING = 'running'#

The step is running right now.

COMPLETED = 'completed'#

The step finished running successfully.

FAILED = 'failed'#

The step ran, but failed.

UNCACHEABLE = 'uncacheable'#

The step is uncacheable. It will be executed as many times as the results are needed, so we don’t keep track of the state.

class tango.step_info.PlatformMetadata(operating_system=<factory>, cpu_count=<factory>, user=<factory>, host=<factory>)[source]#
operating_system: str#

Full operating system name.

cpu_count: Optional[int]#

Numbers of CPUs on the machine.

user: str#

The user that ran this step.

host: str#

Name of the host machine.

class tango.step_info.EnvironmentMetadata(python=<factory>, executable=<factory>, command=<factory>, root=<factory>, packages=<factory>, git=<factory>, tango=<factory>)[source]#
python: str#

The Python version.

executable: Path#

Path to the Python executable.

command: str#

The exact command used.

root: Path#

The root directory from where the Python executable was ran.

packages: Optional[List[Tuple[str, str]]]#

The current set of Python packages in the Python environment. Each entry is a tuple of strings. The first element is the name of the package, the second element is the version.

git: Optional[GitMetadata]#

The GitMetadata.

tango: Optional[TangoMetadata]#

The TangoMetadata.

class tango.step_info.GitMetadata(commit=None, remote=None)[source]#
commit: Optional[str] = None#

The commit SHA of the current repo.

remote: Optional[str] = None#

The URL of the primary remote.

class tango.step_info.TangoMetadata(version='1.3.2')[source]#
version: str = '1.3.2'#

The tango release version.