workflow.core 1.9.10__tar.gz → 1.10.0__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.10 → workflow_core-1.10.0}/PKG-INFO +1 -1
  2. {workflow_core-1.9.10 → workflow_core-1.10.0}/pyproject.toml +1 -1
  3. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/buckets.py +7 -1
  4. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/run.py +23 -0
  5. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/buckets.py +3 -1
  6. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/configure.py +18 -4
  7. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/workspaces/chimefrb.yml +4 -0
  8. {workflow_core-1.9.10 → workflow_core-1.10.0}/README.md +0 -0
  9. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/__init__.py +0 -0
  10. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/__init__.py +0 -0
  11. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/configs.py +0 -0
  12. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/main.py +0 -0
  13. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/pipelines.py +0 -0
  14. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/results.py +0 -0
  15. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/schedules.py +0 -0
  16. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/cli/workspace.py +0 -0
  17. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/daemons/__init__.py +0 -0
  18. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/daemons/audit.py +0 -0
  19. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/daemons/transfer.py +0 -0
  20. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/__init__.py +0 -0
  21. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/config.py +0 -0
  22. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/jsonschema.md +0 -0
  23. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/notify.py +0 -0
  24. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/work.py +0 -0
  25. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/definitions/workspace.py +0 -0
  26. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/examples/autocomplete.py +0 -0
  27. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/examples/function.py +0 -0
  28. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/examples/sample.svg +0 -0
  29. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/examples/sample.workflow.yml +0 -0
  30. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/exceptions.py +0 -0
  31. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/helpers/__init__.py +0 -0
  32. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/helpers/date.py +0 -0
  33. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/__init__.py +0 -0
  34. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/client.py +0 -0
  35. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/configs.py +0 -0
  36. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/context.py +0 -0
  37. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/pipelines.py +0 -0
  38. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/results.py +0 -0
  39. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/http/schedules.py +0 -0
  40. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/__init__.py +0 -0
  41. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/archive/__init__.py +0 -0
  42. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/archive/http.py +0 -0
  43. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/archive/posix.py +0 -0
  44. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/archive/s3.py +0 -0
  45. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/attempt.py +0 -0
  46. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/lifecycle/execute.py +0 -0
  47. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/__init__.py +0 -0
  48. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/decorators.py +0 -0
  49. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/logger.py +0 -0
  50. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/prompt.py +0 -0
  51. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/read.py +0 -0
  52. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/renderers.py +0 -0
  53. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/tmate.sh +0 -0
  54. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/validate.py +0 -0
  55. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/variables.py +0 -0
  56. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/utils/write.py +0 -0
  57. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/workspaces/__init__.py +0 -0
  58. {workflow_core-1.9.10 → workflow_core-1.10.0}/workflow/workspaces/development.yml +0 -0
  59. {workflow_core-1.9.10 → workflow_core-1.10.0}/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.10
3
+ Version: 1.10.0
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.10"
3
+ version = "1.10.0"
4
4
  description = "Workflow Core"
5
5
  authors = ["Shiny Brar <charanjotbrar@gmail.com>"]
6
6
  license = "MIT"
@@ -38,6 +38,9 @@ def buckets():
38
38
  )
39
39
  @click.option("-p", "--parent", type=str, required=False, help="Filter by parent.")
40
40
  @click.option("-f", "--force", is_flag=True, help="Do not prompt for confirmation")
41
+ @click.option(
42
+ "-l", "--limit", type=int, required=False, help="Limit of Work objects to remove."
43
+ )
41
44
  def remove(
42
45
  bucket: str,
43
46
  status: Optional[str] = None,
@@ -45,6 +48,7 @@ def remove(
45
48
  tag: Optional[Tuple[str]] = None,
46
49
  parent: Optional[str] = None,
47
50
  force: bool = False,
51
+ limit: Optional[int] = 100,
48
52
  ):
49
53
  """Remove work[s] from the buckets.
50
54
 
@@ -55,8 +59,9 @@ def remove(
55
59
  tag (Optional[Tuple[str]], optional): Filter by tag. Defaults to None.
56
60
  parent (Optional[str], optional): Filter by parent. Defaults to None.
57
61
  force (bool, optional): Do not prompt for confirmation. Defaults to False.
62
+ limit (int, optional): Limit of Work objects to remove. Defaults to False.
58
63
  """
59
- http = HTTPContext()
64
+ http = HTTPContext(backends=["buckets"])
60
65
  events: Optional[List[int]] = None
61
66
  tags: Optional[List[str]] = None
62
67
  if event:
@@ -70,6 +75,7 @@ def remove(
70
75
  tags=tags,
71
76
  parent=parent,
72
77
  force=force,
78
+ limit=limit,
73
79
  )
74
80
 
75
81
 
@@ -196,6 +196,29 @@ 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
+ "logging": {
213
+ "loki": {
214
+ "tags": {
215
+ # Assumes that there is only one bucket
216
+ "pipeline": buckets[0],
217
+ "site": site,
218
+ }
219
+ }
220
+ }
221
+ })
199
222
  loki_status: bool = configure.loki(logger=logger, config=config)
200
223
  logger.info(f"Loki Logs: {'✅' if loki_status else '❌'}")
201
224
  http: HTTPContext = HTTPContext(backends=["buckets"])
@@ -148,6 +148,7 @@ class Buckets(Client):
148
148
  tags: Optional[List[str]] = None,
149
149
  parent: Optional[str] = None,
150
150
  force: bool = False,
151
+ limit: Optional[int] = 100
151
152
  ) -> bool:
152
153
  """Delete works belonging to a pipeline from the buckets backend.
153
154
 
@@ -161,6 +162,7 @@ class Buckets(Client):
161
162
  event (Optional[List[int]]): The event to delete works with.
162
163
  force (bool, optional): Whether to force the deletion without requiring
163
164
  user confirmation. Defaults to False.
165
+ limit (int, optional): Limit of Work objects to remove. Defaults to False.
164
166
 
165
167
  Returns:
166
168
  bool: Whether any works were deleted.
@@ -171,7 +173,7 @@ class Buckets(Client):
171
173
  query.update({"tags": {"$in": tags}} if tags else {})
172
174
  query.update({"config.parent": parent} if parent else {})
173
175
  projection = {"id": True}
174
- result = self.view(query, projection)
176
+ result = self.view(query, projection, limit=limit)
175
177
  ids: List[str] = []
176
178
  if result:
177
179
  ids = [work["id"] for work in result]
@@ -137,10 +137,24 @@ def defaults(func: Callable[..., Any], work: Work) -> Work:
137
137
  name_in_function = parameter.name
138
138
 
139
139
  if name_in_function not in known:
140
- if hasattr(parameter, "default"):
141
- options[name_in_cli] = parameter.default
142
- elif name_in_function in known:
143
- options[name_in_cli] = parameters.get(name_in_function) # type: ignore
140
+ if hasattr(parameter, "default") and parameter.default:
141
+ parameter_default_value = parameter.default
142
+
143
+ if hasattr(parameter, "is_flag") and parameter.is_flag:
144
+ if parameter_default_value is True:
145
+ # Flags aren't assigned values, its CLI name is just included or not included
146
+ options[name_in_cli] = None
147
+ else:
148
+ options[name_in_cli] = parameter_default_value
149
+ else:
150
+ parameter_given_value = parameters.get(name_in_function) # type: ignore
151
+
152
+ if hasattr(parameter, "is_flag") and parameter.is_flag:
153
+ if parameter_given_value is True:
154
+ # Flags aren't assigned values, its CLI name is just included or not included
155
+ options[name_in_cli] = None
156
+ else:
157
+ options[name_in_cli] = parameter_given_value
144
158
  logger.info(f"click cli options: {options}")
145
159
  work.parameters = options
146
160
  logger.debug(f"work parameters: {work.parameters}")
@@ -104,3 +104,7 @@ deployers:
104
104
  chime:
105
105
  docker:
106
106
  client_url: tcp://frb-vsop.chime:2375
107
+
108
+ logging:
109
+ loki:
110
+ tags: {}
File without changes