https://flyte.org logo
#ask-the-community
Title
# ask-the-community
v

Vitali

01/15/2024, 10:36 AM
Is it possible to get the project and domain in python specified e.g. during the pyflyte call in the workflow definition? We want to set task specification depending on project/domain when defining workflows, here a simplified example:
flyte_project = flytekit.???
flyte_domain = flytekit.???
project_container_image = IMAGEMAP[flyte_project][flyte_domain]
@task(container_image=project_container_image)
def do_it():
do()
k

Ketan (kumare3)

01/15/2024, 4:01 PM
It is possible- using context
Cc @Samhita Alla we are thinking of updating the production docs
We will try and let you know
s

Samhita Alla

01/19/2024, 9:55 AM
you should be able to retrieve project and domain within a task:
Copy code
@task
def t1(project: str):
    print(flytekit.current_context().execution_id.project)
v

Vitali

01/19/2024, 1:48 PM
Thanks for the hint, but we would need it outside the task.
s

Samhita Alla

01/19/2024, 2:05 PM
@Kevin Su do you know if this is possible?
2 Views