Skip to content

afnio.tellurio.run_context

afnio.tellurio.run_context.set_active_run(run)

Sets the active Run globally.

Parameters:

Name Type Description Default
run Run

The Run instance to set as active.

required
Source code in afnio/tellurio/run_context.py
11
12
13
14
15
16
17
18
def set_active_run(run: "Run"):
    """Sets the active [`Run`][afnio.tellurio.run.Run] globally.

    Args:
        run: The Run instance to set as active.
    """
    global _active_run
    _active_run = run

afnio.tellurio.run_context.get_active_run()

Gets the active Run.

If no active Run is set, it raises an exception.

Returns:

Type Description
Run

The currently active Run instance.

Source code in afnio/tellurio/run_context.py
21
22
23
24
25
26
27
28
29
30
31
32
def get_active_run() -> "Run":
    """Gets the active [`Run`][afnio.tellurio.run.Run].

    If no active [`Run`][afnio.tellurio.run.Run] is set, it raises an exception.

    Returns:
        The currently active Run instance.
    """
    global _active_run
    if _active_run is None:
        raise ValueError("No active run is set.")
    return _active_run