workflow.core 1.9.6__tar.gz → 1.9.8__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 (59) hide show
  1. {workflow_core-1.9.6 → workflow_core-1.9.8}/PKG-INFO +1 -1
  2. {workflow_core-1.9.6 → workflow_core-1.9.8}/pyproject.toml +1 -1
  3. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/configs.py +14 -13
  4. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/pipelines.py +16 -4
  5. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/work.py +2 -2
  6. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/renderers.py +34 -5
  7. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/workspaces/chimefrb.yml +8 -8
  8. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/workspaces/development.yml +0 -5
  9. {workflow_core-1.9.6 → workflow_core-1.9.8}/README.md +0 -0
  10. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/__init__.py +0 -0
  11. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/__init__.py +0 -0
  12. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/buckets.py +0 -0
  13. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/main.py +0 -0
  14. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/results.py +0 -0
  15. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/run.py +0 -0
  16. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/schedules.py +0 -0
  17. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/cli/workspace.py +0 -0
  18. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/daemons/__init__.py +0 -0
  19. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/daemons/audit.py +0 -0
  20. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/daemons/transfer.py +0 -0
  21. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/__init__.py +0 -0
  22. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/config.py +0 -0
  23. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/jsonschema.md +0 -0
  24. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/notify.py +0 -0
  25. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/definitions/workspace.py +0 -0
  26. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/examples/autocomplete.py +0 -0
  27. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/examples/function.py +0 -0
  28. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/examples/sample.svg +0 -0
  29. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/examples/sample.workflow.yml +0 -0
  30. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/exceptions.py +0 -0
  31. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/helpers/__init__.py +0 -0
  32. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/helpers/date.py +0 -0
  33. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/__init__.py +0 -0
  34. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/buckets.py +0 -0
  35. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/client.py +0 -0
  36. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/configs.py +0 -0
  37. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/context.py +0 -0
  38. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/pipelines.py +0 -0
  39. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/results.py +0 -0
  40. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/http/schedules.py +0 -0
  41. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/__init__.py +0 -0
  42. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/archive/__init__.py +0 -0
  43. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/archive/http.py +0 -0
  44. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/archive/posix.py +0 -0
  45. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/archive/s3.py +0 -0
  46. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/attempt.py +0 -0
  47. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/configure.py +0 -0
  48. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/lifecycle/execute.py +0 -0
  49. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/__init__.py +0 -0
  50. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/decorators.py +0 -0
  51. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/logger.py +0 -0
  52. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/prompt.py +0 -0
  53. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/read.py +0 -0
  54. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/tmate.sh +0 -0
  55. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/validate.py +0 -0
  56. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/variables.py +0 -0
  57. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/utils/write.py +0 -0
  58. {workflow_core-1.9.6 → workflow_core-1.9.8}/workflow/workspaces/__init__.py +0 -0
  59. {workflow_core-1.9.6 → workflow_core-1.9.8}/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.9.6
3
+ Version: 1.9.8
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.9.6"
3
+ version = "1.9.8"
4
4
  description = "Workflow Core"
5
5
  authors = ["Shiny Brar <charanjotbrar@gmail.com>"]
6
6
  license = "MIT"
@@ -8,10 +8,9 @@ import requests
8
8
  import yaml
9
9
  from rich import pretty
10
10
  from rich.console import Console
11
- from rich.json import JSON
11
+ from rich.syntax import Syntax
12
12
  from rich.table import Table
13
13
  from rich.text import Text
14
- from yaml import safe_load
15
14
  from yaml.loader import SafeLoader
16
15
 
17
16
  from workflow.http.context import HTTPContext
@@ -110,8 +109,10 @@ def deploy(filename: click.Path):
110
109
  except requests.HTTPError as deploy_error:
111
110
  console.print(deploy_error.response.json()["error_description"][0]["msg"])
112
111
  return
112
+ header_text = Text("Config deployed: ")
113
+ header_text.append(data["name"], style="blink underline bright_blue")
113
114
  table.add_column(
114
- "Deploy Result",
115
+ header=header_text,
115
116
  min_width=35,
116
117
  max_width=50,
117
118
  justify="left",
@@ -192,7 +193,7 @@ def ps(name: str, id: str, details: bool):
192
193
  projection: str = json.dumps({})
193
194
  console_content = None
194
195
  column_max_width = 300
195
- column_min_width = 40
196
+ column_min_width = 50
196
197
  try:
197
198
  payload = http.configs.get_configs(
198
199
  name=name, query=query, projection=projection
@@ -210,20 +211,20 @@ def ps(name: str, id: str, details: bool):
210
211
  )
211
212
  text.append(render_config(http, payload))
212
213
  if details:
213
- table.add_column("Details", max_width=column_max_width, justify="left")
214
- _details = safe_load(payload["yaml"])
215
- _details = {
216
- k: v
217
- for k, v in _details.items()
218
- if k not in ["name", "version", "deployments"]
219
- }
220
- table.add_row(text, JSON(json.dumps(_details), indent=2))
214
+ table.add_column(
215
+ "Details",
216
+ max_width=column_max_width,
217
+ min_width=column_min_width,
218
+ justify="left",
219
+ )
220
+ _details = payload["yaml"]
221
+ table.add_row(text, Syntax(_details, "yaml"))
221
222
  else:
222
223
  table.add_row(text)
223
224
  table.add_section()
224
225
  table.add_row(
225
226
  Text("Explore pipelines in detail: \n", style="magenta i").append(
226
- "workflow pipelines ps <config_name> <pipeline_id>",
227
+ "workflow pipelines ps <pipeline_id>",
227
228
  style="dark_blue on cyan",
228
229
  )
229
230
  )
@@ -92,9 +92,9 @@ def count():
92
92
 
93
93
 
94
94
  @pipelines.command("ps", help="Get pipeline details.")
95
- @click.argument("pipeline", type=str, required=True)
95
+ # @click.argument("pipeline", type=str, required=True)
96
96
  @click.argument("id", type=str, required=True)
97
- def ps(pipeline: str, id: str):
97
+ def ps(id: str):
98
98
  """List a pipeline configuration in detail."""
99
99
  http = HTTPContext()
100
100
  query: str = json.dumps({"id": id})
@@ -102,9 +102,21 @@ def ps(pipeline: str, id: str):
102
102
  console_content = None
103
103
  column_max_width = 300
104
104
  column_min_width = 40
105
+ # ? Get Config name, needed for querying the pipeline
106
+ try:
107
+ config_name = http.configs.get_configs(
108
+ query=json.dumps({"pipelines": id}), projection=json.dumps({"name": 1})
109
+ )[0]["name"]
110
+ except Exception:
111
+ error_text = Text(
112
+ f"Could not found any Config parent for Pipeline {id}.", style="red"
113
+ )
114
+ console.print(error_text)
115
+ return
116
+ # ? Get the pipeline
105
117
  try:
106
118
  payload = http.pipelines.get_pipelines(
107
- name=pipeline, query=query, projection=projection
119
+ name=config_name, query=query, projection=projection
108
120
  )[
109
121
  0 # type: ignore
110
122
  ]
@@ -114,7 +126,7 @@ def ps(pipeline: str, id: str):
114
126
  else:
115
127
  text = Text()
116
128
  table.add_column(
117
- f"Pipeline: {pipeline}",
129
+ f"Pipeline: {config_name}",
118
130
  min_width=column_min_width,
119
131
  max_width=column_max_width,
120
132
  justify="left",
@@ -257,12 +257,12 @@ class Work(BaseSettings):
257
257
  timeout: int = Field(
258
258
  default=3600,
259
259
  ge=1,
260
- le=86400,
260
+ le=86400 * 3,
261
261
  description="""
262
262
  Timeout in seconds for the work to finish.
263
263
  After the timeout, the work is marked as failed and retried
264
264
  if the number of attempts is less than the maximum number of retries.
265
- Defaults 3600s (1 hr) with range of [1, 86400] (1s-24hrs).
265
+ Defaults 3600s (1 hr) with range of [1, 259200] (1s-72hrs).
266
266
  """,
267
267
  examples=[7200],
268
268
  )
@@ -78,17 +78,26 @@ def render_config(http: HTTPContext, payload: Dict[str, Any]) -> Text:
78
78
  key_value_text = Text()
79
79
  if k == "pipelines":
80
80
  key_value_text.append(f"{k}: \n", style="bright_blue")
81
- for child in pipelines_statuses:
81
+ for status in pipelines_statuses:
82
82
  key_value_text.append(
83
- f"\t{child['id']}: ", # type: ignore
84
- style=status_colors[child["status"]], # type: ignore
83
+ f"\t{status['id']}: ", # type: ignore
84
+ style=f"{status_colors[status['status']]}", # type: ignore
85
85
  )
86
86
  key_value_text.append(
87
- f"{status_symbols[child['status']]}\n", # type: ignore
88
- style=status_colors[child["status"]], # type: ignore
87
+ f"{status_symbols[status['status']]}\n", # type: ignore
88
+ style=status_colors[status["status"]], # type: ignore
89
89
  )
90
90
  text.append_text(key_value_text)
91
91
  continue
92
+ if k == "deployments":
93
+ key_value_text.append(f"{k}: \n", style="bright_blue")
94
+ if v:
95
+ for deployment in v:
96
+ key_value_text.append_text(render_dict(deployment))
97
+ key_value_text.append("\n")
98
+ text.append_text(key_value_text)
99
+ continue
100
+ continue
92
101
  key_value_text.append(f"{k}: ", style="bright_blue")
93
102
  key_value_text.append(f"{v}\n", style="white")
94
103
  text.append_text(key_value_text)
@@ -96,6 +105,26 @@ def render_config(http: HTTPContext, payload: Dict[str, Any]) -> Text:
96
105
  return text
97
106
 
98
107
 
108
+ def render_dict(payload: Dict[str, Any], listing: bool = True) -> Text:
109
+ """TODO: Missing docstring.
110
+
111
+ Args:
112
+ payload: [TODO:description]
113
+ listing: [TODO:description]
114
+
115
+ Returns:
116
+ [TODO:return]
117
+ """
118
+ text = Text(" - " if listing else "")
119
+ for i_k, i_v in payload.items():
120
+ if isinstance(i_v, dict):
121
+ text.append(render_dict(i_v, listing=False))
122
+ continue
123
+ text.append(f"\t{i_k}: ", style="bright_green")
124
+ text.append(f"{i_v}\n")
125
+ return text
126
+
127
+
99
128
  def clean_output(message: str) -> str:
100
129
  """Cleans strings from Click.command output.
101
130
 
@@ -15,19 +15,19 @@ http:
15
15
  baseurls:
16
16
  buckets:
17
17
  - http://frb-vsop.chime:8004
18
- - https://frb.chimenet.ca/buckets
18
+ - https://frb.chimenet.ca/workflow/buckets
19
19
  results:
20
20
  - http://frb-vsop.chime:8005
21
- - https://frb.chimenet.ca/results
21
+ - https://frb.chimenet.ca/workflow/results
22
22
  pipelines:
23
- - http://frb-vsop.chime:8007
24
- - https://frb.chimenet.ca/pipelines
23
+ - http://frb-vsop.chime:8007/v2
24
+ - https://frb.chimenet.ca/workflow/pipelines/v2
25
25
  configs:
26
- - http://frb-vsop.chime:8007
27
- - https://frb.chimenet.ca/pipelines
26
+ - http://frb-vsop.chime:8007/v2
27
+ - https://frb.chimenet.ca/workflow/pipelines/v2
28
28
  schedules:
29
- - http://frb-vsop.chime:8007
30
- - https://frb.chimenet.ca/pipelines
29
+ - http://frb-vsop.chime:8007/v2
30
+ - https://frb.chimenet.ca/workflow/pipelines/v2
31
31
  loki: https://frb.chimenet.ca/loki/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=
@@ -44,11 +44,6 @@ config:
44
44
  - "move"
45
45
  storage: "posix"
46
46
  results: true
47
- permissions:
48
- posix:
49
- user: "user"
50
- group: "chime-frb-ro"
51
- command: "setfacl -R -m g:{group}:r {path}"
52
47
 
53
48
  deployers:
54
49
  local:
File without changes