workflow.core 1.7.0__tar.gz → 1.8.1__tar.gz

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.
Files changed (58) hide show
  1. {workflow_core-1.7.0 → workflow_core-1.8.1}/PKG-INFO +1 -1
  2. {workflow_core-1.7.0 → workflow_core-1.8.1}/pyproject.toml +1 -1
  3. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/daemons/transfer.py +17 -0
  4. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/config.py +7 -1
  5. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/work.py +6 -7
  6. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/execute.py +6 -1
  7. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/validate.py +1 -0
  8. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/workspaces/chimefrb.yml +11 -5
  9. {workflow_core-1.7.0 → workflow_core-1.8.1}/README.md +0 -0
  10. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/__init__.py +0 -0
  11. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/__init__.py +0 -0
  12. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/buckets.py +0 -0
  13. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/configs.py +0 -0
  14. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/main.py +0 -0
  15. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/pipelines.py +0 -0
  16. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/results.py +0 -0
  17. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/run.py +0 -0
  18. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/schedules.py +0 -0
  19. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/cli/workspace.py +0 -0
  20. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/daemons/__init__.py +0 -0
  21. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/daemons/audit.py +0 -0
  22. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/__init__.py +0 -0
  23. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/jsonschema.md +0 -0
  24. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/notify.py +0 -0
  25. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/definitions/workspace.py +0 -0
  26. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/examples/function.py +0 -0
  27. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/examples/sample.svg +0 -0
  28. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/examples/sample.workflow.yml +0 -0
  29. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/exceptions.py +0 -0
  30. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/helpers/__init__.py +0 -0
  31. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/helpers/date.py +0 -0
  32. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/__init__.py +0 -0
  33. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/buckets.py +0 -0
  34. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/client.py +0 -0
  35. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/configs.py +0 -0
  36. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/context.py +0 -0
  37. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/pipelines.py +0 -0
  38. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/results.py +0 -0
  39. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/http/schedules.py +0 -0
  40. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/__init__.py +0 -0
  41. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/archive/__init__.py +0 -0
  42. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/archive/http.py +0 -0
  43. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/archive/posix.py +0 -0
  44. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/archive/s3.py +0 -0
  45. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/attempt.py +0 -0
  46. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/lifecycle/configure.py +0 -0
  47. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/__init__.py +0 -0
  48. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/decorators.py +0 -0
  49. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/logger.py +0 -0
  50. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/prompt.py +0 -0
  51. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/read.py +0 -0
  52. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/renderers.py +0 -0
  53. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/tmate.sh +0 -0
  54. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/variables.py +0 -0
  55. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/utils/write.py +0 -0
  56. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/workspaces/__init__.py +0 -0
  57. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/workspaces/development.yml +0 -0
  58. {workflow_core-1.7.0 → workflow_core-1.8.1}/workflow/workspaces/site-dev.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: workflow.core
3
- Version: 1.7.0
3
+ Version: 1.8.1
4
4
  Summary: Workflow Core
5
5
  Home-page: https://github.com/chimefrb/workflow
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "workflow.core"
3
- version = "1.7.0"
3
+ version = "1.8.1"
4
4
  description = "Workflow Core"
5
5
  authors = ["Shiny Brar <charanjotbrar@gmail.com>"]
6
6
  license = "MIT"
@@ -109,6 +109,22 @@ def transfer(
109
109
  time.sleep(sleep)
110
110
 
111
111
 
112
+ def check(payload: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
113
+ """Check payload for existing work in results backend.
114
+
115
+ Args:
116
+ payload (List[Dict[str, Any]]): list of work to check.
117
+
118
+ Returns:
119
+ List[Dict[str, Any]]: list of work that does not exist in results.
120
+ """
121
+ for data in payload:
122
+ for key in ["products", "plots", "logs"]:
123
+ if data["config"]["archive"][key] == "pass":
124
+ data["config"]["archive"][key] = "bypass"
125
+ return payload
126
+
127
+
112
128
  def perform(
113
129
  archive: bool,
114
130
  limit: int,
@@ -190,6 +206,7 @@ def perform(
190
206
  payload = http.buckets.view(
191
207
  query={"id": {"$in": transfer}}, projection={}, skip=0, limit=limit * 3
192
208
  )
209
+ payload = check(payload)
193
210
  try:
194
211
  logger.debug(f"tx {len(payload)} works to results")
195
212
  response = http.results.deposit(payload)
@@ -1,6 +1,6 @@
1
1
  """Work Object Configuration."""
2
2
 
3
- from typing import List, Optional
3
+ from typing import List, Literal, Optional
4
4
 
5
5
  from pydantic import Field, field_validator
6
6
  from pydantic_settings import BaseSettings, SettingsConfigDict
@@ -122,3 +122,9 @@ class Config(BaseSettings):
122
122
  """,
123
123
  examples=[["developers", "admins"]],
124
124
  )
125
+ strategy: Literal["strict", "relaxed"] = Field(
126
+ default="strict",
127
+ description="Validation strategy for the work.",
128
+ examples=["strict"],
129
+ exclude=True,
130
+ )
@@ -360,13 +360,12 @@ class Work(BaseSettings):
360
360
  Work: The current work object.
361
361
  """
362
362
  # Validate if the site provided is allowed in the workspace.
363
- config: Dict[str, Any] = read.workspace(self.workspace)
364
- sites: List[str] = config.get("sites", [])
365
- if self.site not in sites:
366
- error = (
367
- f"site: {self.site} not in workspace: {self.workspace} sites: {sites}."
368
- )
369
- raise ValueError(error)
363
+ if self.config.strategy == "strict":
364
+ config: Dict[str, Any] = read.workspace(self.workspace)
365
+ sites: List[str] = config.get("sites", [])
366
+ if self.site not in sites:
367
+ error = f"site {self.site} not in workspace: {sites}."
368
+ raise ValueError(error)
370
369
  return self
371
370
 
372
371
  ###########################################################################
@@ -95,11 +95,16 @@ def command(work: Work) -> Work:
95
95
  try:
96
96
  assert isinstance(work.command, list), "missing command to execute"
97
97
  validate.command(work.command[0])
98
+ to_run: Union[str, List[str]] = work.command
99
+ if len(to_run) == 1:
100
+ to_run = to_run[0]
101
+ is_shell = isinstance(to_run, str)
98
102
  process = subprocess.run(
99
- work.command,
103
+ to_run,
100
104
  stdout=subprocess.PIPE,
101
105
  stderr=subprocess.PIPE,
102
106
  timeout=work.timeout,
107
+ shell=is_shell, # nosec
103
108
  )
104
109
  # Check return code
105
110
  process.check_returncode()
@@ -78,6 +78,7 @@ def command(command: str) -> bool:
78
78
  Returns:
79
79
  bool: True if the command exists, False otherwise.
80
80
  """
81
+ command = command.split(" ")[0]
81
82
  try:
82
83
  if platform.system() == "Windows":
83
84
  response = subprocess.check_output( # nosec
@@ -13,12 +13,18 @@ sites:
13
13
 
14
14
  http:
15
15
  baseurls:
16
- buckets: "https://frb.chimenet.ca/buckets"
17
- results: "https://frb.chimenet.ca/results"
18
- pipelines: "https://frb.chimenet.ca/pipelines"
19
- loki: "https://frb.chimenet.ca/loki/loki/api/v1/push"
16
+ buckets:
17
+ - http://frb-vsop.chime:8004
18
+ - https://frb.chimenet.ca/buckets
19
+ results:
20
+ - http://frb-vsop.chime:8005
21
+ - https://frb.chimenet.ca/results
22
+ pipelines:
23
+ - http://frb-vsop.chime:8007
24
+ - https://frb.chimenet.ca/pipelines
25
+ loki: https://frb.chimenet.ca/loki/loki/api/v1/push
20
26
  # This is the prefix url to make a output data plot or product accessible to the user
21
- products: "https://frb.chimenet.ca/frb-master/v1/events/query-file?filename="
27
+ products: https://frb.chimenet.ca/frb-master/v1/events/query-file?filename=
22
28
 
23
29
  archive:
24
30
  posix:
File without changes