workflow.core 1.11.6__tar.gz → 1.12.2__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 (60) hide show
  1. {workflow_core-1.11.6 → workflow_core-1.12.2}/PKG-INFO +5 -4
  2. {workflow_core-1.11.6 → workflow_core-1.12.2}/README.md +1 -1
  3. {workflow_core-1.11.6 → workflow_core-1.12.2}/pyproject.toml +6 -8
  4. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/configs.py +28 -2
  5. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/run.py +15 -25
  6. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/configs.py +3 -3
  7. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/configure.py +8 -2
  8. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/workspaces/chimefrb.yml +2 -1
  9. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/__init__.py +0 -0
  10. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/__init__.py +0 -0
  11. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/buckets.py +0 -0
  12. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/main.py +0 -0
  13. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/pipelines.py +0 -0
  14. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/results.py +0 -0
  15. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/schedules.py +0 -0
  16. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/cli/workspace.py +0 -0
  17. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/daemons/__init__.py +0 -0
  18. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/daemons/audit.py +0 -0
  19. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/daemons/transfer.py +0 -0
  20. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/__init__.py +0 -0
  21. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/config.py +0 -0
  22. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/jsonschema.md +0 -0
  23. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/notify.py +0 -0
  24. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/work.py +0 -0
  25. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/definitions/workspace.py +0 -0
  26. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/examples/autocomplete.py +0 -0
  27. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/examples/function.py +0 -0
  28. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/examples/sample.svg +0 -0
  29. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/examples/sample.workflow.yml +0 -0
  30. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/exceptions.py +0 -0
  31. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/helpers/__init__.py +0 -0
  32. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/helpers/date.py +0 -0
  33. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/__init__.py +0 -0
  34. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/buckets.py +0 -0
  35. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/client.py +0 -0
  36. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/context.py +0 -0
  37. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/pipelines.py +0 -0
  38. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/results.py +0 -0
  39. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/http/schedules.py +0 -0
  40. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/__init__.py +0 -0
  41. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/archive/__init__.py +0 -0
  42. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/archive/http.py +0 -0
  43. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/archive/posix.py +0 -0
  44. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/archive/s3.py +0 -0
  45. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/attempt.py +0 -0
  46. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/lifecycle/execute.py +0 -0
  47. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/__init__.py +0 -0
  48. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/decorators.py +0 -0
  49. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/format.py +0 -0
  50. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/logger.py +0 -0
  51. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/prompt.py +0 -0
  52. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/read.py +0 -0
  53. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/renderers.py +0 -0
  54. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/tmate.sh +0 -0
  55. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/validate.py +0 -0
  56. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/variables.py +0 -0
  57. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/utils/write.py +0 -0
  58. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/workspaces/__init__.py +0 -0
  59. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/workspaces/development.yml +0 -0
  60. {workflow_core-1.11.6 → workflow_core-1.12.2}/workflow/workspaces/site-dev.yml +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: workflow.core
3
- Version: 1.11.6
3
+ Version: 1.12.2
4
4
  Summary: Workflow Core
5
5
  License: MIT
6
6
  Author: Shiny Brar
@@ -13,17 +13,18 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
16
17
  Requires-Dist: click (>=8.1,<9.0)
17
18
  Requires-Dist: click-params (>=0.5,<0.6)
18
19
  Requires-Dist: docker (>=6.1)
19
20
  Requires-Dist: minio (>=7.2,<8.0)
20
21
  Requires-Dist: pydantic (>=2.0,<3.0)
21
22
  Requires-Dist: pydantic-settings (>=2.0,<3.0)
22
- Requires-Dist: python-logging-loki (>=0.3,<0.4)
23
23
  Requires-Dist: pyyaml (>=6.0,<7.0)
24
24
  Requires-Dist: requests (>=2.31,<3.0)
25
25
  Requires-Dist: rich (>=13.4,<14.0)
26
26
  Requires-Dist: tenacity (>=8.2,<9.0)
27
+ Requires-Dist: tjzegmott-python-logging-loki (>=0.0.1,<0.0.2)
27
28
  Requires-Dist: toml (>=0.10,<0.11)
28
29
  Project-URL: Documentation, https://chimefrb.github.io/workflow-docs/
29
30
  Project-URL: Repository, https://github.com/chimefrb/workflow
@@ -56,7 +57,7 @@ pip install git+https://github.com/chimefrb/workflow.git
56
57
  Alternatively, you can add the Workflow project as a dependency to your own project using Poetry:
57
58
 
58
59
  ```bash
59
- poetry add git+https://github.chime/chimefrb/workflow.git
60
+ poetry add git+https://github.com/chimefrb/workflow.git
60
61
  ```
61
62
 
62
63
  ## Contributing
@@ -25,7 +25,7 @@ pip install git+https://github.com/chimefrb/workflow.git
25
25
  Alternatively, you can add the Workflow project as a dependency to your own project using Poetry:
26
26
 
27
27
  ```bash
28
- poetry add git+https://github.chime/chimefrb/workflow.git
28
+ poetry add git+https://github.com/chimefrb/workflow.git
29
29
  ```
30
30
 
31
31
  ## Contributing
@@ -1,15 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "workflow.core"
3
- version = "1.11.6"
3
+ version = "1.12.2"
4
4
  description = "Workflow Core"
5
5
  authors = ["Shiny Brar <charanjotbrar@gmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  repository = "https://github.com/chimefrb/workflow"
9
9
  documentation = "https://chimefrb.github.io/workflow-docs/"
10
- packages = [
11
- { include = "workflow", from = "." }
12
- ]
10
+ packages = [{ include = "workflow", from = "." }]
13
11
 
14
12
  [tool.poetry.dependencies]
15
13
  python = ">=3.8.1,<4.0"
@@ -22,9 +20,9 @@ toml = "^0.10"
22
20
  rich = "^13.4"
23
21
  minio = "^7.2"
24
22
  pydantic-settings = "^2.0"
25
- python-logging-loki = "^0.3"
26
23
  click-params = "^0.5"
27
24
  docker = ">=6.1"
25
+ tjzegmott-python-logging-loki = "^0.0.1"
28
26
 
29
27
  [tool.poetry.group.dev.dependencies]
30
28
  mypy = "*"
@@ -50,7 +48,7 @@ build-backend = "poetry.core.masonry.api"
50
48
  # Pytest Environment Variables
51
49
  [tool.pytest.ini_options]
52
50
  env = [
53
- "WORKFLOW_S3_ENDPOINT=play.min.io",
54
- "WORKFLOW_S3_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F",
55
- "WORKFLOW_S3_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
51
+ "WORKFLOW_S3_ENDPOINT=play.min.io",
52
+ "WORKFLOW_S3_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F",
53
+ "WORKFLOW_S3_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
56
54
  ]
@@ -1,6 +1,8 @@
1
1
  """Manage workflow pipelines."""
2
2
 
3
3
  import json
4
+ import os
5
+ from pathlib import Path
4
6
  from typing import Any, Dict, List, Optional
5
7
  from urllib.parse import urlencode
6
8
 
@@ -69,13 +71,23 @@ def count():
69
71
  type=click.Path(exists=True, dir_okay=False, readable=True),
70
72
  required=True,
71
73
  )
72
- def deploy(filename: click.Path):
74
+ @click.option(
75
+ "usecanfar",
76
+ "--use-canfar",
77
+ "-uc",
78
+ is_flag=True,
79
+ default=False,
80
+ help="Looks for CANFAR certificate in the machine and sents it in the request.",
81
+ )
82
+ def deploy(filename: click.Path, usecanfar: bool = False):
73
83
  """Deploy a workflow config.
74
84
 
75
85
  Parameters
76
86
  ----------
77
87
  filename : click.Path
78
88
  File path.
89
+ usecanfar : bool
90
+ Whether to look for CANFAR certificate and send it in the request.
79
91
  """
80
92
  http = HTTPContext(backends=["configs"])
81
93
  filepath: str = str(filename)
@@ -106,10 +118,24 @@ def deploy(filename: click.Path):
106
118
  console.print("Cancelling", style="red")
107
119
  return
108
120
 
121
+ if usecanfar:
122
+ console.print("Looking for CANFAR certificate...", style="bright_green")
123
+ cert_path = Path.home() / ".ssl" / "cadcproxy.pem"
124
+ cert_text = None
125
+ if os.path.exists(cert_path):
126
+ cert_text = open(cert_path).read()
127
+ data["canfar_cert"] = cert_text
128
+ console.print("CANFAR certificate found and added.", style="bright_green")
129
+ else:
130
+ console.print(
131
+ "CANFAR certificate not found, proceeding without it.", style="red"
132
+ )
133
+ return
134
+
109
135
  try:
110
136
  deploy_result = http.configs.deploy(data)
111
137
  except requests.HTTPError as deploy_error:
112
- console.print(deploy_error.response.json()["error_description"][0]["msg"])
138
+ console.print(deploy_error.response.json(), style="red")
113
139
  return
114
140
  header_text = Text("Config deployed: ")
115
141
  header_text.append(data["name"], style="blink underline bright_blue")
@@ -196,31 +196,21 @@ def run(
196
196
  "[bold red]Backend Checks [/bold red]",
197
197
  extra=dict(markup=True, color="green"),
198
198
  )
199
- # Add pipeline and site to loki tags
200
- if config.get("logging", {}).get("loki", {}).get("tags", {}):
201
- # Loki tags exist, add pipeline and site
202
- config["logging"]["loki"]["tags"].update(
203
- {
204
- # Assumes that there is only one bucket
205
- "pipeline": buckets[0],
206
- "site": site,
207
- }
208
- )
209
- else:
210
- # Missing Logging config in Workspace
211
- config.update(
212
- {
213
- "logging": {
214
- "loki": {
215
- "tags": {
216
- # Assumes that there is only one bucket
217
- "pipeline": buckets[0],
218
- "site": site,
219
- }
220
- }
221
- }
222
- }
223
- )
199
+ # Add pipeline and site to loki tags, without clobbering the rest of the
200
+ # logging config in the workspace (e.g. loki headers).
201
+ logging_config: Dict[str, Any] = config.get("logging") or {}
202
+ loki_config: Dict[str, Any] = logging_config.get("loki") or {}
203
+ loki_tags: Dict[str, Any] = loki_config.get("tags") or {}
204
+ loki_tags.update(
205
+ {
206
+ # Assumes that there is only one bucket
207
+ "pipeline": buckets[0],
208
+ "site": site,
209
+ }
210
+ )
211
+ loki_config["tags"] = loki_tags
212
+ logging_config["loki"] = loki_config
213
+ config["logging"] = logging_config
224
214
  loki_status: bool = configure.loki(logger=logger, config=config)
225
215
  logger.info(f"Loki Logs: {'✅' if loki_status else '❌'}")
226
216
  http: HTTPContext = HTTPContext(backends=["buckets"])
@@ -22,9 +22,9 @@ class Configs(Client):
22
22
  Configs: A client for interacting with workflow-pipelines.
23
23
  """
24
24
 
25
- @retry(
26
- reraise=True, wait=wait_random(min=0.3, max=1.8), stop=(stop_after_delay(15))
27
- )
25
+ # @retry(
26
+ # reraise=True, wait=wait_random(min=0.3, max=1.8), stop=(stop_after_delay(15))
27
+ # )
28
28
  def deploy(self, data: Dict[str, Any]):
29
29
  """Deploys a Config from payload data.
30
30
 
@@ -61,6 +61,9 @@ def loki(logger: Logger, config: Dict[str, Any]) -> bool:
61
61
  urls: List[str] = []
62
62
  loki_urls: Optional[Any] = config.get("http", {}).get("baseurls", {}).get("loki")
63
63
  loki_tags: Optional[Any] = config.get("logging", {}).get("loki", {}).get("tags", {})
64
+ loki_headers: Optional[Any] = (
65
+ config.get("logging", {}).get("loki", {}).get("headers", {})
66
+ )
64
67
  if not loki_urls:
65
68
  return status
66
69
  elif isinstance(loki_urls, str):
@@ -74,10 +77,13 @@ def loki(logger: Logger, config: Dict[str, Any]) -> bool:
74
77
  for url in urls:
75
78
  try:
76
79
  status_code: int = requests.get(
77
- url.replace("loki/api/v1/push", "ready"), timeout=1
80
+ url.replace("loki/api/v1/push", "loki/api/v1/status/buildinfo"),
81
+ timeout=1,
78
82
  ).status_code
79
83
  if status_code == 200:
80
- loki_handler = LokiHandler(url=url, tags=loki_tags, version="1")
84
+ loki_handler = LokiHandler(
85
+ url=url, tags=loki_tags, headers=loki_headers, version="1"
86
+ )
81
87
  loki_handler.setFormatter(
82
88
  Formatter("%(levelname)s %(tag)s %(name)s %(message)s")
83
89
  )
@@ -28,7 +28,7 @@ http:
28
28
  schedules:
29
29
  - http://frb-vsop.chime:8007/v2
30
30
  - https://frb.chimenet.ca/workflow/pipelines/v2
31
- loki: https://frb.chimenet.ca/loki/loki/api/v1/push
31
+ loki: https://loki.chimefrb.xyz/loki/api/v1/push
32
32
  # This is the prefix url to make a output data plot or product accessible to the user
33
33
  products: https://frb.chimenet.ca/frb-master/v1/events/query-file?filename=
34
34
 
@@ -107,3 +107,4 @@ deployers:
107
107
  logging:
108
108
  loki:
109
109
  tags: {}
110
+ headers: { X-Scope-OrgID: chime }