Deividas Jodogalvis
02/06/2024, 2:51 PMScout
02/06/2024, 2:51 PMpython @asset def my_asset(context: AssetExecutionContext): location_name = (context.get_step_execution_context() .dagster_run.external_job_origin.external_repository_origin .code_location_origin.location_name)
In this example, location_name
will contain the name of the code location associated with the asset. This pattern can be used within an asset definition to programmatically access the code location of the job that the asset is a part of. Keep in mind that this code snippet is meant to be used within the context of an asset definition, and the context object provides access to the execution context from which you can navigate to the code location information.