def initialize(): """ Re-initializes the context and erases the entire context """ # This is supplied so that tasks that rely on Flyte provided param functionality do not fail when run locally default_execution_id = _identifier.WorkflowExecutionIdentifier( project="local", domain="local", name="local") # Note we use the SdkWorkflowExecution object purely for formatting into the ex:project:domain:name format users # are already acquainted with default_user_space_params = ExecutionParameters( execution_id=str( _SdkWorkflowExecutionIdentifier.promote_from_model( default_execution_id)), execution_date=_datetime.datetime.utcnow(), stats=_mock_stats.MockStats(), logging=_logging, tmp_dir=os.path.join(_sdk_config.LOCAL_SANDBOX.get(), "user_space"), ) default_context = FlyteContext( file_access=_data_proxy.default_local_file_access_provider) default_context = default_context.with_execution_state( default_context.new_execution_state().with_params( user_space_params=default_user_space_params)).build() default_context.set_stackframe( s=FlyteContextManager.get_origin_stackframe()) FlyteContextManager._OBJS = [default_context]
elif self._parent is not None: return self._parent.flyte_client else: raise Exception("No flyte_client initialized") # Hack... we'll think of something better in the future class FlyteEntities(object): entities = [] # This is supplied so that tasks that rely on Flyte provided param functionality do not fail when run locally default_execution_id = _identifier.WorkflowExecutionIdentifier(project="local", domain="local", name="local") # Note we use the SdkWorkflowExecution object purely for formatting into the ex:project:domain:name format users # are already acquainted with default_user_space_params = ExecutionParameters( execution_id=str( _SdkWorkflowExecutionIdentifier.promote_from_model( default_execution_id)), execution_date=_datetime.datetime.utcnow(), stats=_mock_stats.MockStats(), logging=_logging, tmp_dir=os.path.join(_sdk_config.LOCAL_SANDBOX.get(), "user_space"), ) default_context = FlyteContext( user_space_params=default_user_space_params, file_access=_data_proxy.default_local_file_access_provider) FlyteContext.OBJS.append(default_context)