airflow-unicore-integration 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,7 +63,7 @@ class NaiveJobDescriptionGenerator(JobDescriptionGenerator):
63
63
  else:
64
64
  python_env = conf.get("unicore.executor", "DEFAULT_ENV")
65
65
  # prepare dag file to be uploaded via unicore
66
- # dag_file = open(local_dag_path)
66
+ # dag_file = open("/tmp/test")
67
67
  # dag_content = dag_file.readlines()
68
68
  # dag_import = {"To": dag_rel_path, "Data": dag_content}
69
69
  worker_script_import = {
@@ -84,20 +84,28 @@ class NaiveJobDescriptionGenerator(JobDescriptionGenerator):
84
84
  "AIRFLOW__CORE__DAGS_FOLDER": "./",
85
85
  "AIRFLOW__LOGGING__LOGGING_LEVEL": "DEBUG",
86
86
  "AIRFLOW__CORE__EXECUTOR": "LocalExecutor,airflow_unicore_integration.executors.unicore_executor.UnicoreExecutor",
87
- "AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST": os.environ.get(
88
- "AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST", ""
89
- ),
90
87
  }
88
+
89
+ # build filecontent string for importing in the job | this is needed to avoid confusing nested quotes and trying to escape them properly when using unicore env vars directly
90
+ env_file_content: list[str] = [
91
+ f"export AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST='{os.environ.get("AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST", "")}'"
92
+ ]
93
+
91
94
  # insert connection details that are provided via env vars to get bundles
92
95
  for env_key in os.environ.keys():
93
96
  if env_key.startswith("AIRFLOW_CONN_"):
94
- job_descr_dict["Environment"][env_key] = os.environ[env_key]
95
- user_added_pre_commands.append(f"source {python_env}/bin/activate")
97
+ env_file_content.append(f"export {env_key}='{os.environ[env_key]}'")
98
+
99
+ airflow_env_import = {"To": "airflow_config.env", "Data": env_file_content}
100
+
101
+ user_added_pre_commands.append(
102
+ f"source airflow_config.env && source {python_env}/bin/activate"
103
+ )
96
104
  job_descr_dict["User precommand"] = ";".join(user_added_pre_commands)
97
105
  job_descr_dict["RunUserPrecommandOnLoginNode"] = (
98
106
  "false" # precommand includes activating the python env, this should be done on compute node right before running the job
99
107
  )
100
- job_descr_dict["Imports"] = [worker_script_import]
108
+ job_descr_dict["Imports"] = [worker_script_import, airflow_env_import]
101
109
  # add user defined options to description
102
110
  if user_added_env:
103
111
  job_descr_dict["Environment"].update(user_added_env)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airflow-unicore-integration
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Running Unicore Jobs from airflow DAGs.
5
5
  Author-email: Christian Böttcher <c.boettcher@fz-juelich.de>
6
6
  License-Expression: BSD-3-Clause
@@ -7,10 +7,10 @@ airflow_unicore_integration/hooks/unicore_hooks.py,sha256=JjcjogWtN1xveagpkraQuY
7
7
  airflow_unicore_integration/operators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  airflow_unicore_integration/operators/unicore_operators.py,sha256=xYX1t_QzjpqHZDoEu6jJNNXVmBEnjIlApFWvgYoYoB0,16790
9
9
  airflow_unicore_integration/policies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- airflow_unicore_integration/util/job.py,sha256=HNWwr7kENnnmX0gO65jm1yGHAYuTFZJ8jg-FKKiZ1ro,6327
11
- airflow_unicore_integration-0.1.3.dist-info/licenses/LICENSE,sha256=hZ5ouAedeNr8ClHrQE-RLsgMsARcmv3kSZz7tE2BTJE,1526
12
- airflow_unicore_integration-0.1.3.dist-info/METADATA,sha256=AE34sl5fO5XTUxv-b71OvctxROXUK22Ip8hOC9J4_4o,11188
13
- airflow_unicore_integration-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- airflow_unicore_integration-0.1.3.dist-info/entry_points.txt,sha256=PzEfCLYLSawjiYR-HNBzw8-YGfJxs1nPBULevgBQjoY,147
15
- airflow_unicore_integration-0.1.3.dist-info/top_level.txt,sha256=j45X-uIuOk3oL78iwlpHakMWtUkg__B7zUlJLwmZx6w,28
16
- airflow_unicore_integration-0.1.3.dist-info/RECORD,,
10
+ airflow_unicore_integration/util/job.py,sha256=BSP-XuWL5-TRGACX__MavIcmPAA52gYLdwWL236cVz8,6703
11
+ airflow_unicore_integration-0.1.5.dist-info/licenses/LICENSE,sha256=hZ5ouAedeNr8ClHrQE-RLsgMsARcmv3kSZz7tE2BTJE,1526
12
+ airflow_unicore_integration-0.1.5.dist-info/METADATA,sha256=ZtH2sUzOSHxsDmVSIgb-yJ61i7bi9Zc2olzdPhaeMHE,11188
13
+ airflow_unicore_integration-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ airflow_unicore_integration-0.1.5.dist-info/entry_points.txt,sha256=PzEfCLYLSawjiYR-HNBzw8-YGfJxs1nPBULevgBQjoY,147
15
+ airflow_unicore_integration-0.1.5.dist-info/top_level.txt,sha256=j45X-uIuOk3oL78iwlpHakMWtUkg__B7zUlJLwmZx6w,28
16
+ airflow_unicore_integration-0.1.5.dist-info/RECORD,,