import sys
from typing import TYPE_CHECKING
[docs]WPS_BOUNDINGBOX = "bbox"
[docs]WPS_REFERENCE = "reference"
[docs]WPS_COMPLEX_DATA = "ComplexData"
[docs]WPS_LITERAL_DATA_TYPE_NAMES = frozenset([
"date", "time", "dateTime", "anyURI", "scale", "angle", "float", "double",
"int", "integer", "long", "positiveInteger", "nonNegativeInteger", "bool", "boolean", "string"
])
# opensearch
[docs]OPENSEARCH_START_DATE = "StartDate"
[docs]OPENSEARCH_END_DATE = "EndDate"
[docs]OPENSEARCH_COLLECTION = "collection"
# data source cache
[docs]OPENSEARCH_LOCAL_FILE_SCHEME = "opensearchfile" # must be a valid url scheme parsable by urlparse
# CWL package (requirements/hints) corresponding to `PROCESS_APPLICATION`
[docs]CWL_REQUIREMENT_APP_BUILTIN = "BuiltinRequirement"
[docs]CWL_REQUIREMENT_APP_DOCKER = "DockerRequirement"
[docs]CWL_REQUIREMENT_APP_DOCKER_GPU = "DockerGpuRequirement"
[docs]CWL_REQUIREMENT_APP_ESGF_CWT = "ESGF-CWTRequirement"
[docs]CWL_REQUIREMENT_APP_WPS1 = "WPS1Requirement"
[docs]CWL_REQUIREMENT_APP_TYPES = frozenset([
CWL_REQUIREMENT_APP_BUILTIN,
CWL_REQUIREMENT_APP_DOCKER,
# FIXME: properly support GPU execution
# - https://github.com/crim-ca/weaver/issues/104
# - https://github.com/crim-ca/weaver/issues/138
# CWL_REQUIREMENT_APP_DOCKER_GPU,
CWL_REQUIREMENT_APP_ESGF_CWT,
CWL_REQUIREMENT_APP_WPS1,
])
"""
Set of :term:`CWL` requirements consisting of known :term:`Application Package` by this `Weaver` instance.
"""
[docs]CWL_REQUIREMENT_APP_REMOTE = frozenset([
CWL_REQUIREMENT_APP_ESGF_CWT,
CWL_REQUIREMENT_APP_WPS1,
])
"""
Set of :term:`CWL` requirements that correspond to remote execution of an :term:`Application Package`.
"""
[docs]CWL_REQUIREMENT_ENV_VAR = "EnvVarRequirement"
[docs]CWL_REQUIREMENT_INIT_WORKDIR = "InitialWorkDirRequirement"
[docs]CWL_REQUIREMENT_SCATTER = "ScatterFeatureRequirement"
[docs]CWL_REQUIREMENT_FEATURES = frozenset([
CWL_REQUIREMENT_ENV_VAR,
CWL_REQUIREMENT_INIT_WORKDIR,
# CWL_REQUIREMENT_SCATTER, # FIXME: see workflow test + fix https://github.com/crim-ca/weaver/issues/105
])
"""
Set of :term:`CWL` requirements that corresponds to extra functionalities not completely defining
an :term:`Application Package` by themselves.
"""
[docs]CWL_REQUIREMENTS_SUPPORTED = frozenset(
list(CWL_REQUIREMENT_APP_TYPES) +
list(CWL_REQUIREMENT_FEATURES)
)
"""
Set of all :term:`CWL` requirements or hints that are supported for deployment of valid :term:`Application Package`.
"""
# CWL package types and extensions
[docs]PACKAGE_SIMPLE_TYPES = frozenset(["string", "boolean", "float", "int", "integer", "long", "double"])
[docs]PACKAGE_LITERAL_TYPES = frozenset(list(PACKAGE_SIMPLE_TYPES) + ["null", "Any"])
[docs]PACKAGE_COMPLEX_TYPES = frozenset(["File"]) # FIXME: type "Directory" not supported
[docs]PACKAGE_ENUM_BASE = "enum"
[docs]PACKAGE_CUSTOM_TYPES = frozenset([PACKAGE_ENUM_BASE]) # can be anything, but support "enum" which is more common
[docs]PACKAGE_ARRAY_BASE = "array"
[docs]PACKAGE_ARRAY_MAX_SIZE = sys.maxsize # pywps doesn't allow None, so use max size # FIXME: unbounded (weaver #165)
[docs]PACKAGE_ARRAY_ITEMS = frozenset(list(PACKAGE_SIMPLE_TYPES) + list(PACKAGE_COMPLEX_TYPES) + list(PACKAGE_CUSTOM_TYPES))
[docs]PACKAGE_ARRAY_TYPES = frozenset(["{}[]".format(item) for item in PACKAGE_ARRAY_ITEMS])
# string values the lowest 'type' field can have by itself (as simple mapping {type: <type-string>})
[docs]PACKAGE_TYPE_NULLABLE = frozenset(list(PACKAGE_SIMPLE_TYPES) + list(PACKAGE_CUSTOM_TYPES) + list(PACKAGE_COMPLEX_TYPES))
# shortcut notations that can be employed to convert basic types into corresponding array or nullable variants
[docs]PACKAGE_SHORTCUTS = frozenset(["{}?".format(typ) for typ in PACKAGE_TYPE_NULLABLE] +
list(PACKAGE_ARRAY_TYPES) +
["{}?".format(typ) for typ in PACKAGE_ARRAY_TYPES])
[docs]PACKAGE_TYPE_POSSIBLE_VALUES = frozenset(
list(PACKAGE_LITERAL_TYPES) +
list(PACKAGE_COMPLEX_TYPES) +
list(PACKAGE_SHORTCUTS)
)
[docs]PROCESS_SCHEMA_OGC = "OGC"
[docs]PROCESS_SCHEMA_OLD = "OLD"
[docs]PROCESS_SCHEMAS = frozenset([
PROCESS_SCHEMA_OGC,
PROCESS_SCHEMA_OLD,
])
if TYPE_CHECKING:
from weaver.typedefs import Literal
[docs] ProcessSchemaType = Literal[PROCESS_SCHEMA_OGC, PROCESS_SCHEMA_OGC]