gavicore 0.2.0.dev1__tar.gz → 0.3.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.
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/.gitignore +6 -2
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/PKG-INFO +1 -1
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/__init__.py +10 -3
- gavicore-0.3.0/gavicore/dru_models.py +214 -0
- gavicore-0.3.0/gavicore/dru_service.py +88 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/models.py +4 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/request.py +1 -1
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/pyproject.toml +1 -1
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/LICENSE +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/README.md +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/py.typed +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/service/__init__.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/service/errors.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/service/service.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/__init__.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/cli/__init__.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/cli/group.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/cli/parameters.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/dynimp.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/ensure.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/model.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/obj.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/runsync.py +0 -0
- {gavicore-0.2.0.dev1 → gavicore-0.3.0}/gavicore/util/testing.py +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Testing
|
|
2
2
|
*.zarr/
|
|
3
3
|
.cov-report
|
|
4
|
+
notebooks/auth-test.ipynb
|
|
4
5
|
|
|
5
|
-
#
|
|
6
|
-
docs/notebooks
|
|
6
|
+
# Legacy generated documentation (excluded from the site)
|
|
7
|
+
docs/notebooks/
|
|
7
8
|
|
|
8
9
|
# Byte-compiled / optimized / DLL files
|
|
9
10
|
__pycache__/
|
|
@@ -202,3 +203,6 @@ cython_debug/
|
|
|
202
203
|
# refer to https://docs.cursor.com/context/ignore-files
|
|
203
204
|
.cursorignore
|
|
204
205
|
.cursorindexingignore
|
|
206
|
+
|
|
207
|
+
# Downloaded font assets
|
|
208
|
+
docs/assets/fonts/*.ttf
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gavicore
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Pydantic data models and common utilities for other Eozilla packages
|
|
5
5
|
Project-URL: Documentation, https://eo-tools.github.io/eozilla
|
|
6
6
|
Project-URL: Repository, https://github.com/eo-tools/eozilla
|
|
@@ -7,22 +7,29 @@ from importlib.metadata import version
|
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel
|
|
9
9
|
|
|
10
|
-
from . import models, service
|
|
10
|
+
from . import dru_models, dru_service, models, service
|
|
11
11
|
|
|
12
12
|
__version__ = version("gavicore")
|
|
13
13
|
|
|
14
14
|
__all__ = [
|
|
15
15
|
"__version__",
|
|
16
|
+
"dru_models",
|
|
17
|
+
"dru_service",
|
|
16
18
|
"models",
|
|
17
19
|
"service",
|
|
18
20
|
]
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
def _patch_models():
|
|
22
|
-
for name, obj in inspect.getmembers(models, inspect.isclass)
|
|
24
|
+
for name, obj in inspect.getmembers(models, inspect.isclass) + inspect.getmembers(
|
|
25
|
+
dru_models, inspect.isclass
|
|
26
|
+
):
|
|
23
27
|
if (
|
|
24
28
|
not name.startswith("_")
|
|
25
|
-
and
|
|
29
|
+
and (
|
|
30
|
+
obj.__module__ == models.__name__
|
|
31
|
+
or obj.__module__ == dru_models.__name__
|
|
32
|
+
)
|
|
26
33
|
and issubclass(obj, BaseModel)
|
|
27
34
|
):
|
|
28
35
|
# Make model object render nicely in Jupyter notebooks
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Copyright (c) 2026- by the Eozilla team and contributors
|
|
2
|
+
# Permissions are hereby granted under the terms of the Apache 2.0 License:
|
|
3
|
+
# https://opensource.org/license/apache-2-0.
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Annotated, Any, Literal, TypeAlias
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
from .models import Link, OgcBaseModel, ProcessDescription
|
|
12
|
+
|
|
13
|
+
# ---------------------------------------------------------------------
|
|
14
|
+
# OGC Application Package and Workflow descriptions
|
|
15
|
+
# ---------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class OgcApplicationPackage(BaseModel):
|
|
19
|
+
"""
|
|
20
|
+
An OGC Application Package is a document that describes a process in
|
|
21
|
+
sufficient detail so that an implementation of this Standard can
|
|
22
|
+
dynamically deploy that process and make it accessible via an the
|
|
23
|
+
processes API defined in "OGC API - Processes - Part 1: Core".
|
|
24
|
+
|
|
25
|
+
For more information, see: /req/ogcapppkg/schema
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
process_description: OgcApplicationPackageProcessDescription | None = Field(
|
|
29
|
+
None, alias="processDescription"
|
|
30
|
+
)
|
|
31
|
+
"""Process description of a given process."""
|
|
32
|
+
|
|
33
|
+
execution_unit: ExecutionUnitBase | list[ExecutionUnitBase] = Field(
|
|
34
|
+
alias="executionUnit"
|
|
35
|
+
)
|
|
36
|
+
"""The execution unit of process."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class OgcApplicationPackageProcessDescription(BaseModel):
|
|
40
|
+
"""Wrapper around `ProcessDescription` to insert additional field name."""
|
|
41
|
+
|
|
42
|
+
process: ProcessDescription | None = None
|
|
43
|
+
"""The process description."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CwlDescription(BaseModel):
|
|
47
|
+
"""
|
|
48
|
+
Possible encoding of an execution unit as CWL.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
media_type: Annotated[Literal["application/cwl"], Field(..., alias="mediaType")]
|
|
52
|
+
"""Media type used to identify the execution unit type.
|
|
53
|
+
Must always be 'application/cwl'."""
|
|
54
|
+
|
|
55
|
+
# NOTE: field must follow CWL schema, which cannot easily
|
|
56
|
+
# be converted to Pydantic model.
|
|
57
|
+
value: dict[str, Any] | None = None
|
|
58
|
+
"""JSON-encoded CWL document."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ContainerImage(BaseModel):
|
|
62
|
+
"""The execute unit is a container image."""
|
|
63
|
+
|
|
64
|
+
type: Literal["docker", "oci"]
|
|
65
|
+
"""Type of container image."""
|
|
66
|
+
|
|
67
|
+
value: ExecutionUnitContainer | None = None
|
|
68
|
+
"""Description of container image"""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class ExecutionUnitContainer(OgcBaseModel):
|
|
72
|
+
"""Execution unit described by a container image."""
|
|
73
|
+
|
|
74
|
+
image: str
|
|
75
|
+
"""Container image reference for the execution unit."""
|
|
76
|
+
|
|
77
|
+
deployment: Literal["local", "remote", "hpc", "cloud"] | None = None
|
|
78
|
+
"""Deployment information for the execution unit."""
|
|
79
|
+
|
|
80
|
+
config: ContainerConfig | None = None
|
|
81
|
+
"""Optional configuration for image execution."""
|
|
82
|
+
|
|
83
|
+
bindings: ContainerBindings | None = None
|
|
84
|
+
"""Binding properties for inputs and outputs."""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ContainerConfig(OgcBaseModel):
|
|
88
|
+
"""Hardware requirements and configuration properties
|
|
89
|
+
for executing the process."""
|
|
90
|
+
|
|
91
|
+
cpu_min: int | None = Field(None, ge=1, alias="cpuMin")
|
|
92
|
+
"""Minimum number of CPUs required to run the process (unit is CPU core)."""
|
|
93
|
+
|
|
94
|
+
cpu_max: int | None = Field(None, alias="cpuMax")
|
|
95
|
+
"""Maximum number of CPU dedicated to the process (unit is CPU core)."""
|
|
96
|
+
|
|
97
|
+
memory_min: int | float | None = Field(None, alias="memoryMin")
|
|
98
|
+
"""Minimum RAM memory required to run the application (unit is GB)."""
|
|
99
|
+
|
|
100
|
+
memory_max: int | float | None = Field(None, alias="memoryMax")
|
|
101
|
+
"""Maximum RAM memory dedicated to the application (unit is GB)."""
|
|
102
|
+
|
|
103
|
+
storage_temp_min: int | float | None = Field(None, alias="storageTempMin")
|
|
104
|
+
""" Minimum required temporary storage size (unit is GB)."""
|
|
105
|
+
|
|
106
|
+
storage_outputs_min: int | float | None = Field(None, alias="storageOutputsMin")
|
|
107
|
+
"""Minimum required output storage size (unit is GB)."""
|
|
108
|
+
|
|
109
|
+
job_timeout: int | float | None = Field(None, alias="jobTimeout")
|
|
110
|
+
"""Timeout delay for a job execution (in seconds)."""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ContainerBindings(BaseModel):
|
|
114
|
+
"""Input and output bindings of a container image execution unit."""
|
|
115
|
+
|
|
116
|
+
input_bindings: InputBinding | None = Field(None, alias="inputBindings")
|
|
117
|
+
"""Input bindings."""
|
|
118
|
+
|
|
119
|
+
output_bindings: OutputBinding | None = Field(None, alias="outputBindings")
|
|
120
|
+
"""Output bindings."""
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class InputBinding(OgcBaseModel):
|
|
124
|
+
"""Defines how to specify the input for the execution unit.
|
|
125
|
+
|
|
126
|
+
- The value of various properties defined below can be expressions.
|
|
127
|
+
- The expression language SHALL be JavaScript(???).
|
|
128
|
+
- The "$(...)" syntax can be used to reference the current input or other
|
|
129
|
+
process inputs in an expression.
|
|
130
|
+
- The value "self" refers to the value of the current input.
|
|
131
|
+
- The value "inputs.<other_input>" refers to the value of another
|
|
132
|
+
process input.
|
|
133
|
+
- If the input is defined as a string of format "file" or "directory"
|
|
134
|
+
then the meta-values ".path", ".basename", ".nameroot" and ".nameext"
|
|
135
|
+
can be used to manipulate file or directory name without having to
|
|
136
|
+
resort to complex regular expressions.
|
|
137
|
+
- ".path" returns the path of a file name without the file name
|
|
138
|
+
- ".basename" returns the name of the file without the path
|
|
139
|
+
- ".nameroot" returns the basename without any extension
|
|
140
|
+
- ".nameext" returns the extension of the basename
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
prefix: str | None = None
|
|
144
|
+
"""Command line prefix to add before the value."""
|
|
145
|
+
|
|
146
|
+
position: int | str | None = None
|
|
147
|
+
"""
|
|
148
|
+
- The zero-based sorting key.
|
|
149
|
+
- The value can be an integer or a string.
|
|
150
|
+
- If the value is a string then it should be an expression that evaluates
|
|
151
|
+
to a single integer value or null.
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
value_from: str | None = Field(None, alias="valueFrom")
|
|
155
|
+
"""
|
|
156
|
+
- If valueFrom is a constant string value, use this as the value.
|
|
157
|
+
- If valueFrom is an expression, evaluate the expression to yield the
|
|
158
|
+
actual value to use to build the command line.
|
|
159
|
+
- If the value of the associated input parameter is null, valueFrom is
|
|
160
|
+
not evaluated and nothing is added to the command line.
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
item_separator: str | None = Field(None, alias="itemSeparator")
|
|
164
|
+
""" Join the array elements into a single string with the elements
|
|
165
|
+
separated by itemSeparator."""
|
|
166
|
+
|
|
167
|
+
shell_quote: bool | None = Field(None, alias="shellQuote")
|
|
168
|
+
"""
|
|
169
|
+
- A Boolean that controls whether the value is quoted on the command.
|
|
170
|
+
- A value of true (or if shecllQuote is not provided) means that the
|
|
171
|
+
implementation SHALL not permit the interpretation of any shell
|
|
172
|
+
metacharacters or directives.
|
|
173
|
+
- A value of false should be used to inject metacharacters for operations
|
|
174
|
+
such as pipes.
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class OutputBinding(OgcBaseModel):
|
|
179
|
+
"""Defines how to retrieve the output result from the command."""
|
|
180
|
+
|
|
181
|
+
glob: str | list[str] | None = None
|
|
182
|
+
"""
|
|
183
|
+
- Wildcard pattern to find the output on disk or mounted volume.
|
|
184
|
+
- Uses UNIX "glob" wildcard patterns (see: "man 7 glob").
|
|
185
|
+
- See inputBinding.yaml (modeled as InputBinding) for referencing
|
|
186
|
+
input values in an output
|
|
187
|
+
binding "glob" expression.
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class GenericExecutionUnit(BaseModel):
|
|
192
|
+
"""A generic execution unit.
|
|
193
|
+
|
|
194
|
+
The standard notes:
|
|
195
|
+
The execution unit is not Docker/OCI or CWL and cannot be properly
|
|
196
|
+
described via the "mediaType" property of a qualified value
|
|
197
|
+
using an RFC 2046 media type (e.g. an "R" or "Python" script).
|
|
198
|
+
In this case a community-defined or custom token may be used
|
|
199
|
+
with the "type" property.
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
type: str
|
|
203
|
+
"""Type of execution unit"""
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
ExecutionUnitBase: TypeAlias = (
|
|
207
|
+
Link | CwlDescription | ContainerImage | GenericExecutionUnit
|
|
208
|
+
)
|
|
209
|
+
"""Execution unit encoding of a process."""
|
|
210
|
+
|
|
211
|
+
ContainerBindings.model_rebuild()
|
|
212
|
+
ExecutionUnitContainer.model_rebuild()
|
|
213
|
+
ContainerImage.model_rebuild()
|
|
214
|
+
OgcApplicationPackage.model_rebuild()
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Copyright (c) 2026- by the Eozilla team and contributors
|
|
2
|
+
# Permissions are hereby granted under the terms of the Apache 2.0 License:
|
|
3
|
+
# https://opensource.org/license/apache-2-0.
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
from .dru_models import OgcApplicationPackage
|
|
9
|
+
from .models import ProcessSummary
|
|
10
|
+
from .service import Service
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DruService(Service, ABC):
|
|
14
|
+
"""The DruService interface extends the Service interface by providing
|
|
15
|
+
four endpoints defined per
|
|
16
|
+
[OGC API - Processes — Part 2 (DRU)](https://docs.ogc.org/DRAFTS/20-044.html)."""
|
|
17
|
+
|
|
18
|
+
@abstractmethod
|
|
19
|
+
async def deploy_process(
|
|
20
|
+
self, w: str | None = None, *args, **kwargs
|
|
21
|
+
) -> Optional[ProcessSummary]:
|
|
22
|
+
"""Deploy a new process to a server supporting
|
|
23
|
+
OGC API - Processes — Part 2 (DRU) by providing a process
|
|
24
|
+
description in a supported format.
|
|
25
|
+
|
|
26
|
+
Depending on the service implementation,
|
|
27
|
+
the server may not return a response body.
|
|
28
|
+
|
|
29
|
+
For more information, see
|
|
30
|
+
[OGC API - Processes — Part 2 (DRU)](https://docs.ogc.org/DRAFTS/20-044.html#deploy).
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
w: Optionally point to the workflow identifier for deploying a
|
|
34
|
+
CWL containing multiple workflow definitions.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
@abstractmethod
|
|
38
|
+
async def replace_process(
|
|
39
|
+
self,
|
|
40
|
+
process_id: str,
|
|
41
|
+
w: str | None = None,
|
|
42
|
+
*args,
|
|
43
|
+
**kwargs,
|
|
44
|
+
) -> Optional[ProcessSummary]:
|
|
45
|
+
"""Replace an exisitng and mutable process by providing a new
|
|
46
|
+
process description in a supported format.
|
|
47
|
+
|
|
48
|
+
Depending on the service implementation,
|
|
49
|
+
the server may not return a response body.
|
|
50
|
+
|
|
51
|
+
For more information, see
|
|
52
|
+
[OGC API - Processes — Part 2 (DRU)](https://docs.ogc.org/DRAFTS/20-044.html#replace).
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
process_id: Unique identifier of registered process
|
|
56
|
+
that is to be replaced.
|
|
57
|
+
w: Optionally point to the workflow identifier for deploying a
|
|
58
|
+
CWL containing multiple workflow definitions.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
async def undeploy_process(self, process_id: str, *args, **kwargs) -> None:
|
|
63
|
+
"""Remove an exisitng and mutable process by providing
|
|
64
|
+
its process id.
|
|
65
|
+
|
|
66
|
+
For more information, see
|
|
67
|
+
[OGC API - Processes — Part 2 (DRU)](https://docs.ogc.org/DRAFTS/20-044.html#undeploy).
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
process_id: Unique identifier of registered process
|
|
71
|
+
that is to be replaced.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
@abstractmethod
|
|
75
|
+
async def get_formal_description(
|
|
76
|
+
self, process_id: str, *args, **kwargs
|
|
77
|
+
) -> OgcApplicationPackage:
|
|
78
|
+
"""Retrieve a formal description of a previously deployed process
|
|
79
|
+
via the deploy operation.
|
|
80
|
+
The returned description relates to the most recent deployment.
|
|
81
|
+
|
|
82
|
+
For more information, see
|
|
83
|
+
[OGC API - Processes — Part 2 (DRU)](https://docs.ogc.org/DRAFTS/20-044.html#application-package-retrieval-operation).
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
process_id: Unique identifier of registered process
|
|
87
|
+
that is to be replaced.
|
|
88
|
+
"""
|
|
@@ -398,6 +398,10 @@ class ProcessSummary(DescriptionType):
|
|
|
398
398
|
version: str
|
|
399
399
|
"""Process version number."""
|
|
400
400
|
|
|
401
|
+
mutable: bool | None = None
|
|
402
|
+
"""Mutability of process. This value is `True` for processes deployed
|
|
403
|
+
dynamically to DRU-enabled servers."""
|
|
404
|
+
|
|
401
405
|
jobControlOptions: list[JobControlOptions] | None = None
|
|
402
406
|
"""Available options to control process execution."""
|
|
403
407
|
|
|
@@ -30,7 +30,7 @@ class ExecutionRequest(ProcessRequest):
|
|
|
30
30
|
- to allow the process identifier being part of the request,
|
|
31
31
|
- to allow creating nested object values for input names with dots.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Attributes:
|
|
34
34
|
process_id: Process identifier
|
|
35
35
|
dotpath: Whether dots in input names should be used to create
|
|
36
36
|
nested object values. Defaults to `False`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|