flytekit.FlyteContext#
- class flytekit.FlyteContext(file_access, level=0, flyte_client=None, compilation_state=None, execution_state=None, serialization_settings=None, in_a_condition=False, origin_stackframe=None, output_metadata_tracker=None, worker_queue=None)[source]#
This is an internal-facing context object, that most users will not have to deal with. It’s essentially a globally available grab bag of settings and objects that allows flytekit to do things like convert complex types, run and compile workflows, serialize Flyte entities, etc.
Even though this object as a
current_context
function on it, it should not be called directly. Please use theflytekit.FlyteContextManager
object instead.Please do not confuse this object with the
flytekit.ExecutionParameters
object.Methods
- Parameters:
file_access (FileAccessProvider)
level (int)
flyte_client (Optional['friendly_client.SynchronousFlyteClient'])
compilation_state (Optional[CompilationState])
execution_state (Optional[ExecutionState])
serialization_settings (Optional[SerializationSettings])
in_a_condition (bool)
origin_stackframe (Optional[traceback.FrameSummary])
output_metadata_tracker (Optional[OutputMetadataTracker])
worker_queue (Optional[Controller])
- static current_context()[source]#
This method exists only to maintain backwards compatibility. Please use
FlyteContextManager.current_context()
instead.Users of flytekit should be wary not to confuse the object returned from this function with
flytekit.current_context()
- Return type:
- get_deck()[source]#
Returns the deck that was created as part of the last execution.
The return value depends on the execution environment. In a notebook, the return value is compatible with IPython.display and should be rendered in the notebook.
with flytekit.new_context() as ctx: my_task(...) ctx.get_deck()
OR if you wish to explicitly display
from IPython import display display(ctx.get_deck())
- new_compilation_state(prefix='')[source]#
Creates and returns a default compilation state. For most of the code this should be the entrypoint of compilation, otherwise the code should always uses - with_compilation_state
- Parameters:
prefix (str)
- Return type:
CompilationState
- new_execution_state(working_dir=None)[source]#
Creates and returns a new default execution state. This should be used at the entrypoint of execution, in all other cases it is preferable to use with_execution_state
- Parameters:
working_dir (PathLike | None)
- Return type:
- set_stackframe(s)[source]#
- Parameters:
s (FrameSummary)
- with_execution_state(es)[source]#
- Parameters:
es (ExecutionState)
- Return type:
Builder
Attributes
- compilation_state: CompilationState | None = None
- execution_state: ExecutionState | None = None
- flyte_client: 'friendly_client.SynchronousFlyteClient' | None = None
- in_a_condition: bool = False
- level: int = 0
- origin_stackframe: traceback.FrameSummary | None = None
- output_metadata_tracker: OutputMetadataTracker | None = None
- serialization_settings: SerializationSettings | None = None
- user_space_params
- worker_queue: Controller | None = None
- file_access: FileAccessProvider