GitHub user gopidesupavan added a comment to the discussion: [Bug]
`standard.operators.python` fails the task randomly
it must be setup issue on your side it looks like i am not able reproduce, i
ran this example its working
```
from airflow.sdk import dag, Param
from airflow.sdk import task
@task.virtualenv(
system_site_packages = False,
venv_cache_path="venvs/test",
inherit_env = True
)
def virtual_task(variables:dict, logical_date = None, params = None):
print(variables)
print(f"This is param: {params} !!!!!")
print(f"This is logical_date: {logical_date} !!!!!")
return
@task(task_id="load_vars_for_venv")
def load_vars_for_venv(var_list:list):
from airflow.sdk import Variable
variables = {}
for variable in var_list:
variables[variable] = Variable.get(variable)
return variables
@dag(
dag_id="test",
params={
"P": Param("HI", type="string")
}
)
def test():
variables = load_vars_for_venv(var_list=["DATASETTE_DB_SECRET"])
virtual_task(variables=variables)
test()
```
Whats the easiest and simple way to reproduce your behaviour?
GitHub link:
https://github.com/apache/airflow/discussions/54534#discussioncomment-14113658
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]