dkist-processing-ops 1.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of dkist-processing-ops might be problematic. Click here for more details.
- dkist_processing_ops/__init__.py +0 -0
- dkist_processing_ops/_version.py +16 -0
- dkist_processing_ops/dags/scale.py +78 -0
- dkist_processing_ops/tasks/__init__.py +2 -0
- dkist_processing_ops/tasks/wait.py +15 -0
- dkist_processing_ops/tests/__init__.py +0 -0
- dkist_processing_ops/tests/test_workflows.py +9 -0
- dkist_processing_ops/workflows/__init__.py +0 -0
- dkist_processing_ops/workflows/smoke.py +28 -0
- dkist_processing_ops-1.0.0.dist-info/LICENSE.rst +8 -0
- dkist_processing_ops-1.0.0.dist-info/METADATA +41 -0
- dkist_processing_ops-1.0.0.dist-info/RECORD +14 -0
- dkist_processing_ops-1.0.0.dist-info/WHEEL +5 -0
- dkist_processing_ops-1.0.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '1.0.0'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 0, 0)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DAG to use up workers to support scaling
|
|
3
|
+
"""
|
|
4
|
+
from os import environ
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from dkist_processing_core.build_utils import export_dags
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def export_scale_dags(path: Path | str) -> list[Path]:
|
|
11
|
+
"""Export all the ops dags"""
|
|
12
|
+
result = []
|
|
13
|
+
dag_prefix = "ops_scale"
|
|
14
|
+
scales = [16, 32]
|
|
15
|
+
queues = ["default", "high_memory"]
|
|
16
|
+
sleep_duration_seconds = 60
|
|
17
|
+
for queue in queues:
|
|
18
|
+
for scale in scales:
|
|
19
|
+
dag_name = f"{dag_prefix}_{queue}_{scale}"
|
|
20
|
+
dag_body = _scale_dag(
|
|
21
|
+
dag_name=dag_name,
|
|
22
|
+
sleep_duration_seconds=sleep_duration_seconds,
|
|
23
|
+
queue=queue,
|
|
24
|
+
concurrent_task_count=scale,
|
|
25
|
+
)
|
|
26
|
+
dag_path = _export_ops_dag(dag_name=dag_name, dag_body=dag_body, path=path)
|
|
27
|
+
result.append(dag_path)
|
|
28
|
+
return result
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _export_ops_dag(dag_name: str, dag_body: str, path: Path | str | None = None) -> Path:
|
|
32
|
+
"""Write a file representation of the scaling DAG."""
|
|
33
|
+
path = path or "dags/"
|
|
34
|
+
path = Path(path)
|
|
35
|
+
path.mkdir(exist_ok=True)
|
|
36
|
+
version = environ.get("BUILD_VERSION", "dev")
|
|
37
|
+
dag_name = f"{dag_name}_{version}"
|
|
38
|
+
workflow_py = path / f"{dag_name}.py"
|
|
39
|
+
with workflow_py.open(mode="w") as f:
|
|
40
|
+
f.write(dag_body)
|
|
41
|
+
return workflow_py
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _scale_dag(
|
|
45
|
+
dag_name: str,
|
|
46
|
+
sleep_duration_seconds: int = 60,
|
|
47
|
+
queue: str | None = None,
|
|
48
|
+
concurrent_task_count: int = 16,
|
|
49
|
+
) -> str:
|
|
50
|
+
queue = queue or "default"
|
|
51
|
+
|
|
52
|
+
imports = f"""# Scale {concurrent_task_count} DAG on queue {queue}
|
|
53
|
+
from datetime import timedelta
|
|
54
|
+
import pendulum
|
|
55
|
+
from airflow import DAG
|
|
56
|
+
from airflow.operators.bash import BashOperator
|
|
57
|
+
"""
|
|
58
|
+
dag = f"""with DAG(
|
|
59
|
+
dag_id="{dag_name}",
|
|
60
|
+
start_date=pendulum.today("UTC").add(days=-2),
|
|
61
|
+
schedule=None,
|
|
62
|
+
catchup=False,
|
|
63
|
+
tags=["ops", "scale"],
|
|
64
|
+
) as d:"""
|
|
65
|
+
tasks = []
|
|
66
|
+
for idx in range(concurrent_task_count):
|
|
67
|
+
task = f""" t{idx} = BashOperator(
|
|
68
|
+
task_id="t{idx}",
|
|
69
|
+
bash_command=f"sleep {sleep_duration_seconds}",
|
|
70
|
+
retries=0,
|
|
71
|
+
retry_delay=timedelta(seconds=60),
|
|
72
|
+
owner="DKIST Data Center",
|
|
73
|
+
queue="{queue}",
|
|
74
|
+
)"""
|
|
75
|
+
tasks.append(task)
|
|
76
|
+
parts = [imports, dag] + tasks
|
|
77
|
+
body = "\n".join(parts)
|
|
78
|
+
return body
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Task for parallelization testing which sleeps a configurable amount of time"""
|
|
2
|
+
from time import sleep
|
|
3
|
+
|
|
4
|
+
from dkist_processing_core import TaskBase
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
__all__ = ["WaitTask"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
SLEEP_TIME = 60
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class WaitTask(TaskBase):
|
|
14
|
+
def run(self) -> None:
|
|
15
|
+
sleep(SLEEP_TIME)
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Test integrity of workflows."""
|
|
2
|
+
from dkist_processing_core.build_utils import validate_workflows
|
|
3
|
+
|
|
4
|
+
from dkist_processing_ops import workflows
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_workflow_integrity():
|
|
8
|
+
"""Validate workflow to ensure acyclic-ness and export compilation"""
|
|
9
|
+
validate_workflows(workflows)
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Workflows to test task submission and spin up"""
|
|
2
|
+
from dkist_processing_common.tasks import TrialTeardown
|
|
3
|
+
from dkist_processing_core import ResourceQueue
|
|
4
|
+
from dkist_processing_core import Workflow
|
|
5
|
+
|
|
6
|
+
from dkist_processing_ops.tasks import WaitTask
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
smoke_default = Workflow(
|
|
10
|
+
input_data="ops",
|
|
11
|
+
output_data="common",
|
|
12
|
+
category="smoke",
|
|
13
|
+
detail="default",
|
|
14
|
+
workflow_package=__package__,
|
|
15
|
+
)
|
|
16
|
+
smoke_default.add_node(task=WaitTask, upstreams=None, resource_queue=ResourceQueue.DEFAULT)
|
|
17
|
+
smoke_default.add_node(task=TrialTeardown, upstreams=WaitTask)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
smoke_high_mem = Workflow(
|
|
21
|
+
input_data="ops",
|
|
22
|
+
output_data="common",
|
|
23
|
+
category="smoke",
|
|
24
|
+
detail="high-mem",
|
|
25
|
+
workflow_package=__package__,
|
|
26
|
+
)
|
|
27
|
+
smoke_high_mem.add_node(task=WaitTask, upstreams=None, resource_queue=ResourceQueue.HIGH_MEMORY)
|
|
28
|
+
smoke_high_mem.add_node(task=TrialTeardown, upstreams=WaitTask)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
License
|
|
2
|
+
-------
|
|
3
|
+
|
|
4
|
+
This project is Copyright (c) NSO / AURA and licensed under
|
|
5
|
+
the terms of the BSD 3-Clause license. This package is based upon
|
|
6
|
+
the `Openastronomy packaging guide <https://github.com/OpenAstronomy/packaging-guide>`_
|
|
7
|
+
which is licensed under the BSD 3-clause licence. See the licenses folder for
|
|
8
|
+
more information.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dkist-processing-ops
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Automated Processing smoke test and operations workflows
|
|
5
|
+
Author-email: NSO / AURA <dkistdc@nso.edu>
|
|
6
|
+
License: BSD 3-Clause
|
|
7
|
+
Project-URL: repository, https://bitbucket.org/dkistdc/dkist-processing-ops
|
|
8
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/x-rst
|
|
13
|
+
License-File: LICENSE.rst
|
|
14
|
+
Requires-Dist: dkist-processing-common ==6.1.0
|
|
15
|
+
Requires-Dist: dkist-service-configuration ==1.1.0
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: pytest ; extra == 'test'
|
|
18
|
+
Requires-Dist: pytest-cov ; extra == 'test'
|
|
19
|
+
Requires-Dist: pytest-xdist ; extra == 'test'
|
|
20
|
+
|
|
21
|
+
dkist-processing-ops
|
|
22
|
+
--------------------
|
|
23
|
+
|codecov|
|
|
24
|
+
|
|
25
|
+
This repository works in concert with `dkist-processing-core <https://pypi.org/project/dkist-processing-core/>`_ and
|
|
26
|
+
`dkist-processing-common <https://pypi.org/project/dkist-processing-common/>`_ to provide workflows for the
|
|
27
|
+
operational management and smoke testing of the `Automated Processing <https://nso.atlassian.net/wiki/spaces/DPD/pages/3671451/04+-+Automated+Processing>`_ stack.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Developer Setup
|
|
31
|
+
~~~~~~~~~~~~~~~
|
|
32
|
+
|
|
33
|
+
.. code-block:: bash
|
|
34
|
+
|
|
35
|
+
pip install -e .[test]
|
|
36
|
+
pip install pre-commit
|
|
37
|
+
pre-commit install
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
.. |codecov| image:: https://codecov.io/bb/dkistdc/dkist-processing-ops/branch/main/graph/badge.svg
|
|
41
|
+
:target: https://codecov.io/bb/dkistdc/dkist-processing-ops
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
dkist_processing_ops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
dkist_processing_ops/_version.py,sha256=DGJ4pj32xs3_DRJhSzQwCiRNnAQrMgo09USYpyMZsKc,411
|
|
3
|
+
dkist_processing_ops/dags/scale.py,sha256=GE3SzSEZT-UDnsL1U-DqLNxlW_VudNzXMLezSDDE_Tk,2341
|
|
4
|
+
dkist_processing_ops/tasks/__init__.py,sha256=P81O9cg4dlBMqBTaWitdsAte68RsMtDlhV30JSZfXUY,107
|
|
5
|
+
dkist_processing_ops/tasks/wait.py,sha256=uObka-nH1dKPcGBDsp3t2RCtTV2F1kksM0V-lRewFuY,273
|
|
6
|
+
dkist_processing_ops/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
dkist_processing_ops/tests/test_workflows.py,sha256=Ch_8BlGeQyPJU_9hB_GOncwW-SoZwpRUVKMOEz0RQZk,285
|
|
8
|
+
dkist_processing_ops/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
dkist_processing_ops/workflows/smoke.py,sha256=ofXu0_iYF6L3zQy-BOVvS5VdzKhmXs1gyugqMNkd-GM,878
|
|
10
|
+
dkist_processing_ops-1.0.0.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
|
|
11
|
+
dkist_processing_ops-1.0.0.dist-info/METADATA,sha256=nKfMDV6uFh1gswS0EGU8TykLQa44Y8JsEwgZcc4XQbg,1498
|
|
12
|
+
dkist_processing_ops-1.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
13
|
+
dkist_processing_ops-1.0.0.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
|
|
14
|
+
dkist_processing_ops-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dkist_processing_ops
|