runnable 0.21.0__tar.gz → 0.22.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. {runnable-0.21.0 → runnable-0.22.0}/PKG-INFO +1 -1
  2. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/argo.py +27 -1
  3. {runnable-0.21.0 → runnable-0.22.0}/pyproject.toml +1 -1
  4. {runnable-0.21.0 → runnable-0.22.0}/runnable/utils.py +10 -2
  5. {runnable-0.21.0 → runnable-0.22.0}/.gitignore +0 -0
  6. {runnable-0.21.0 → runnable-0.22.0}/LICENSE +0 -0
  7. {runnable-0.21.0 → runnable-0.22.0}/README.md +0 -0
  8. {runnable-0.21.0 → runnable-0.22.0}/extensions/README.md +0 -0
  9. {runnable-0.21.0 → runnable-0.22.0}/extensions/__init__.py +0 -0
  10. {runnable-0.21.0 → runnable-0.22.0}/extensions/catalog/README.md +0 -0
  11. {runnable-0.21.0 → runnable-0.22.0}/extensions/catalog/file_system.py +0 -0
  12. {runnable-0.21.0 → runnable-0.22.0}/extensions/catalog/pyproject.toml +0 -0
  13. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/README.md +0 -0
  14. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/__init__.py +0 -0
  15. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/k8s.py +0 -0
  16. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/k8s_job_spec.yaml +0 -0
  17. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/local.py +0 -0
  18. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/local_container.py +0 -0
  19. {runnable-0.21.0 → runnable-0.22.0}/extensions/job_executor/pyproject.toml +0 -0
  20. {runnable-0.21.0 → runnable-0.22.0}/extensions/nodes/README.md +0 -0
  21. {runnable-0.21.0 → runnable-0.22.0}/extensions/nodes/nodes.py +0 -0
  22. {runnable-0.21.0 → runnable-0.22.0}/extensions/nodes/pyproject.toml +0 -0
  23. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/README.md +0 -0
  24. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/__init__.py +0 -0
  25. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/local.py +0 -0
  26. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/local_container.py +0 -0
  27. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/mocked.py +0 -0
  28. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/pyproject.toml +0 -0
  29. {runnable-0.21.0 → runnable-0.22.0}/extensions/pipeline_executor/retry.py +0 -0
  30. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/README.md +0 -0
  31. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/__init__.py +0 -0
  32. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/chunked_fs.py +0 -0
  33. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/db/implementation_FF.py +0 -0
  34. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/db/integration_FF.py +0 -0
  35. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/file_system.py +0 -0
  36. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/generic_chunked.py +0 -0
  37. {runnable-0.21.0 → runnable-0.22.0}/extensions/run_log_store/pyproject.toml +0 -0
  38. {runnable-0.21.0 → runnable-0.22.0}/extensions/secrets/README.md +0 -0
  39. {runnable-0.21.0 → runnable-0.22.0}/extensions/secrets/dotenv.py +0 -0
  40. {runnable-0.21.0 → runnable-0.22.0}/extensions/secrets/pyproject.toml +0 -0
  41. {runnable-0.21.0 → runnable-0.22.0}/runnable/__init__.py +0 -0
  42. {runnable-0.21.0 → runnable-0.22.0}/runnable/catalog.py +0 -0
  43. {runnable-0.21.0 → runnable-0.22.0}/runnable/cli.py +0 -0
  44. {runnable-0.21.0 → runnable-0.22.0}/runnable/context.py +0 -0
  45. {runnable-0.21.0 → runnable-0.22.0}/runnable/datastore.py +0 -0
  46. {runnable-0.21.0 → runnable-0.22.0}/runnable/defaults.py +0 -0
  47. {runnable-0.21.0 → runnable-0.22.0}/runnable/entrypoints.py +0 -0
  48. {runnable-0.21.0 → runnable-0.22.0}/runnable/exceptions.py +0 -0
  49. {runnable-0.21.0 → runnable-0.22.0}/runnable/executor.py +0 -0
  50. {runnable-0.21.0 → runnable-0.22.0}/runnable/graph.py +0 -0
  51. {runnable-0.21.0 → runnable-0.22.0}/runnable/names.py +0 -0
  52. {runnable-0.21.0 → runnable-0.22.0}/runnable/nodes.py +0 -0
  53. {runnable-0.21.0 → runnable-0.22.0}/runnable/parameters.py +0 -0
  54. {runnable-0.21.0 → runnable-0.22.0}/runnable/pickler.py +0 -0
  55. {runnable-0.21.0 → runnable-0.22.0}/runnable/sdk.py +0 -0
  56. {runnable-0.21.0 → runnable-0.22.0}/runnable/secrets.py +0 -0
  57. {runnable-0.21.0 → runnable-0.22.0}/runnable/tasks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runnable
3
- Version: 0.21.0
3
+ Version: 0.22.0
4
4
  Summary: Add your description here
5
5
  Author-email: "Vammi, Vijay" <vijay.vammi@astrazeneca.com>
6
6
  License-File: LICENSE
@@ -244,6 +244,7 @@ class TemplateDefaults(BaseModelWIthConfig):
244
244
  image: str
245
245
  image_pull_policy: Optional[ImagePullPolicy] = Field(default=ImagePullPolicy.Always)
246
246
  resources: Resources = Field(default_factory=Resources)
247
+ env: list[EnvVar | SecretEnvVar] = Field(default_factory=list, exclude=True)
247
248
 
248
249
 
249
250
  # User provides this as part of the argoSpec
@@ -365,6 +366,7 @@ class ArgoExecutor(GenericPipelineExecutor):
365
366
  custom_volumes: Optional[list[CustomVolume]] = Field(
366
367
  default_factory=list[CustomVolume]
367
368
  )
369
+ env: list[EnvVar] = Field(default_factory=list[EnvVar])
368
370
 
369
371
  expose_parameters_as_inputs: bool = True
370
372
  secret_from_k8s: Optional[str] = Field(default=None)
@@ -508,6 +510,10 @@ class ArgoExecutor(GenericPipelineExecutor):
508
510
  )
509
511
 
510
512
  self._set_up_initial_container(container_template=core_container_template)
513
+ self._expose_secrets_to_task(
514
+ working_on=node, container_template=core_container_template
515
+ )
516
+ self._set_env_vars_to_task(node, core_container_template)
511
517
 
512
518
  container_template = ContainerTemplate(
513
519
  container=core_container_template,
@@ -523,12 +529,32 @@ class ArgoExecutor(GenericPipelineExecutor):
523
529
 
524
530
  return container_template
525
531
 
532
+ def _set_env_vars_to_task(
533
+ self, working_on: BaseNode, container_template: CoreContainerTemplate
534
+ ):
535
+ if not isinstance(working_on, TaskNode):
536
+ return
537
+ global_envs: dict[str, str] = {}
538
+
539
+ for env_var in self.env:
540
+ global_envs[env_var.name] = env_var.value
541
+
542
+ node_overide = {}
543
+ if hasattr(working_on, "overides"):
544
+ node_overide = working_on.overides
545
+
546
+ global_envs.update(node_overide.get("env", {}))
547
+ for key, value in global_envs.items():
548
+ env_var_to_add = EnvVar(name=key, value=value)
549
+ container_template.env.append(env_var_to_add)
550
+
526
551
  def _expose_secrets_to_task(
527
552
  self,
528
553
  working_on: BaseNode,
529
554
  container_template: CoreContainerTemplate,
530
555
  ):
531
- assert isinstance(working_on, TaskNode)
556
+ if not isinstance(working_on, TaskNode):
557
+ return
532
558
  secrets = working_on.executable.secrets
533
559
  for secret in secrets:
534
560
  assert self.secret_from_k8s is not None
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "runnable"
3
- version = "0.21.0"
3
+ version = "0.22.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -109,8 +109,16 @@ def apply_variables(
109
109
  raise Exception("Argument Variables should be dict")
110
110
 
111
111
  json_d = json.dumps(apply_to)
112
- transformed = str_template(json_d).substitute(**variables)
113
- return json.loads(transformed)
112
+ string_template = str_template(json_d)
113
+
114
+ template = string_template.safe_substitute(variables)
115
+
116
+ if "$" in template:
117
+ logger.warning(
118
+ "Not all variables found in the config are found in the variables"
119
+ )
120
+
121
+ return json.loads(template)
114
122
 
115
123
 
116
124
  def get_module_and_attr_names(command: str) -> Tuple[str, str]:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes