flytekit.FlyteContextManager

class flytekit.FlyteContextManager[source]

FlyteContextManager manages the execution context within Flytekit. It holds global state of either compilation or Execution. It is not thread-safe and can only be run as a single threaded application currently. Context’s within Flytekit is useful to manage compilation state and execution state. Refer to CompilationState and ExecutionState for more information. FlyteContextManager provides a singleton stack to manage these contexts.

Typical usage is

FlyteContextManager.initialize()
with FlyteContextManager.with_context(o) as ctx:
  pass

# If required - not recommended you can use
FlyteContextManager.push_context()
# but correspondingly a pop_context should be called
FlyteContextManager.pop_context()

Methods

static current_context()[source]
Return type:

FlyteContext

static get_origin_stackframe(limit=2)[source]
Return type:

FrameSummary

static initialize()[source]

Re-initializes the context and erases the entire context

static pop_context()[source]
Return type:

FlyteContext

static push_context(ctx, f=None)[source]
Parameters:
Return type:

FlyteContext

static size()[source]
Return type:

int

static with_context(b)[source]
Parameters:

b (Builder)

Return type:

Generator[FlyteContext, None, None]