airflow-unicore-integration 0.1.9__py3-none-any.whl → 0.1.10__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.
@@ -34,10 +34,13 @@ class JobDescriptionGenerator:
34
34
  def create_job_description(self, workload: ExecuteTask) -> Dict[str, Any]:
35
35
  raise NotImplementedError()
36
36
 
37
+ def get_job_name(self, key: TaskInstanceKey) -> str:
38
+ return f"{key.dag_id} - {key.task_id} - {key.run_id} - {key.try_number}"
39
+
37
40
 
38
41
  class NaiveJobDescriptionGenerator(JobDescriptionGenerator):
39
42
  """
40
- This class generates a naive unicore job, that expects there to be a working python env containign airflow and any other required dependencies on the executing system.
43
+ This class generates a naive unicore job, that expects there to be a working python env containing airflow and any other required dependencies on the executing system.
41
44
  """
42
45
 
43
46
  GIT_DAG_BUNDLE_CLASSPATH = "airflow.providers.git.bundles.git.GitDagBundle"
@@ -84,7 +87,7 @@ class NaiveJobDescriptionGenerator(JobDescriptionGenerator):
84
87
  "Data": LAUNCH_SCRIPT_CONTENT_STR,
85
88
  }
86
89
  # start filling the actual job description
87
- job_descr_dict["Name"] = f"{key.dag_id} - {key.task_id} - {key.run_id} - {key.try_number}"
90
+ job_descr_dict["Name"] = self.get_job_name(key)
88
91
  job_descr_dict["Executable"] = (
89
92
  f". airflow_config.env && . {python_env} && python run_task_via_supervisor.py --json-string '{workload.model_dump_json()}'" # TODO may require module load to be setup for some systems
90
93
  )
@@ -153,12 +156,20 @@ class NaiveJobDescriptionGenerator(JobDescriptionGenerator):
153
156
 
154
157
  airflow_env_import = {"To": "airflow_config.env", "Data": env_file_content}
155
158
 
156
- job_descr_dict["User postcommand"] = ";".join(user_added_post_commands)
157
- job_descr_dict["User precommand"] = ";".join(user_added_pre_commands)
159
+ job_descr_dict["Imports"] = [worker_script_import, airflow_env_import]
160
+
161
+ if len(user_added_pre_commands) > 0:
162
+ precommand_import = {"To": "precommand.sh", "Data": user_added_pre_commands}
163
+ job_descr_dict["Imports"].append(precommand_import)
164
+ job_descr_dict["User precommand"] = "bash precommand.sh"
165
+ if len(user_added_post_commands) > 0:
166
+ postcommand_import = {"To": "postcommand.sh", "Data": user_added_post_commands}
167
+ job_descr_dict["Imports"].append(postcommand_import)
168
+ job_descr_dict["User postcommand"] = "bash postcommand.sh"
169
+
158
170
  job_descr_dict["RunUserPrecommandOnLoginNode"] = (
159
171
  "true" # precommand needs public internet access to clone dag repos
160
172
  )
161
- job_descr_dict["Imports"] = [worker_script_import, airflow_env_import]
162
173
  # add user defined options to description
163
174
  if user_added_env:
164
175
  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.9
3
+ Version: 0.1.10
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,11 +7,11 @@ 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=Te3HNieipFQ3KrCzEf17wvSN5FnBgelW9Q3jMyr6Irg,9590
10
+ airflow_unicore_integration/util/job.py,sha256=sOCizQa748VFkfa2eIXBnDDe0SxUSBgKRuZsX0gcZtE,10071
11
11
  airflow_unicore_integration/util/launch_script_content.py,sha256=42_aFpaCMmvFmmUxQDGcudkleX1YSK_yYWE8T41NOy0,2915
12
- airflow_unicore_integration-0.1.9.dist-info/licenses/LICENSE,sha256=hZ5ouAedeNr8ClHrQE-RLsgMsARcmv3kSZz7tE2BTJE,1526
13
- airflow_unicore_integration-0.1.9.dist-info/METADATA,sha256=b-AYw8ivzM6mpVLuMDJpl5oHsKFYaIXs3_vtb6cniWM,11188
14
- airflow_unicore_integration-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- airflow_unicore_integration-0.1.9.dist-info/entry_points.txt,sha256=PzEfCLYLSawjiYR-HNBzw8-YGfJxs1nPBULevgBQjoY,147
16
- airflow_unicore_integration-0.1.9.dist-info/top_level.txt,sha256=j45X-uIuOk3oL78iwlpHakMWtUkg__B7zUlJLwmZx6w,28
17
- airflow_unicore_integration-0.1.9.dist-info/RECORD,,
12
+ airflow_unicore_integration-0.1.10.dist-info/licenses/LICENSE,sha256=hZ5ouAedeNr8ClHrQE-RLsgMsARcmv3kSZz7tE2BTJE,1526
13
+ airflow_unicore_integration-0.1.10.dist-info/METADATA,sha256=LaldAzHtkWk8Ex0OuGZ6RNc_rg_0PQhHhPmANcsaW8k,11189
14
+ airflow_unicore_integration-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ airflow_unicore_integration-0.1.10.dist-info/entry_points.txt,sha256=PzEfCLYLSawjiYR-HNBzw8-YGfJxs1nPBULevgBQjoY,147
16
+ airflow_unicore_integration-0.1.10.dist-info/top_level.txt,sha256=j45X-uIuOk3oL78iwlpHakMWtUkg__B7zUlJLwmZx6w,28
17
+ airflow_unicore_integration-0.1.10.dist-info/RECORD,,