-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
230 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
from typing import List | ||
|
||
from pydantic import BaseModel, validator, Extra, root_validator, conlist | ||
|
||
from .requests import Pipeline | ||
|
||
from backend.views.http.etl import ( | ||
EnumManifestGenerationPolicy, | ||
EnumManifestPriority, | ||
IOSystem | ||
) | ||
|
||
class TapisIOBox(IOSystem): | ||
writable_system_id: str = None | ||
data_transfer_system_id: str = None | ||
|
||
@root_validator | ||
def validate_system_ids(cls, values): | ||
if ( | ||
values.get("writable_system_id") == None | ||
and values.get("data_transfer_system_id") == None | ||
): | ||
raise ValueError("Must define one or both of the following properties: ['writable_system_id', 'data_transfer_system_id']") | ||
|
||
return values | ||
|
||
class TapisRemoteOutbox(TapisIOBox): | ||
manifest_generation_policy: EnumManifestGenerationPolicy = None | ||
manifest_priority: EnumManifestPriority = EnumManifestPriority.Oldest | ||
data_path: str = "/ETL/REMOTE-OUTBOX/DATA" | ||
manifests_path: str = "/ETL/REMOTE-OUTBOX/MANFIFESTS" | ||
|
||
class TapisLocalInbox(TapisIOBox): | ||
manifest_generation_policy: EnumManifestGenerationPolicy = EnumManifestGenerationPolicy.AutoOnePerFile | ||
manifest_priority: EnumManifestPriority = EnumManifestPriority.Oldest | ||
data_path: str = "/ETL/LOCAL-INBOX/DATA" | ||
manifests_path: str = "/ETL/LOCAL-INBOX/MANFIFESTS" | ||
inbound_transfer_manifests_path: str = "/ETL/LOCAL-INBOX/" | ||
|
||
class TapisLocalOutbox(TapisIOBox): | ||
manifest_generation_policy: EnumManifestGenerationPolicy = EnumManifestGenerationPolicy.AutoOneForAll | ||
manifest_priority: EnumManifestPriority = EnumManifestPriority.Oldest | ||
data_path: str = "/ETL/LOCAL-INBOX/DATA" | ||
manifests_path: str = "/ETL/LOCAL-INBOX/MANFIFESTS" | ||
|
||
class TapisRemoteInbox(TapisIOBox): | ||
manifest_generation_policy: EnumManifestGenerationPolicy = None | ||
manifest_priority: EnumManifestPriority = None | ||
data_path: str = "/ETL/REMOTE-INBOX/DATA" | ||
manifests_path: str = "/ETL/REMOTE-INBOX/MANFIFESTS" | ||
|
||
|
||
class TapisJobDef(BaseModel): | ||
pass | ||
|
||
class TapisJobWorkflowsETL(BaseModel): | ||
input: str | ||
output: str | ||
|
||
class TapisJobWorkflowsExtension(BaseModel): | ||
etl: TapisJobWorkflowsETL | ||
|
||
class ExetendedTapisJob(TapisJobDef): | ||
workflows: TapisJobWorkflowsExtension = None | ||
|
||
class Config: | ||
extra = Extra.allow | ||
|
||
ListOfStrMinOneItem = conlist(str, min_items=1) | ||
|
||
class ActionFilter(BaseModel): | ||
pipeline_ids: ListOfStrMinOneItem = None | ||
run_async: bool = True | ||
|
||
class TapisETLPipeline(Pipeline): | ||
before: ActionFilter = None | ||
remote_outbox: TapisRemoteOutbox | ||
local_inbox: TapisLocalInbox | ||
jobs: List[ExetendedTapisJob] | ||
local_outbox: TapisLocalOutbox | ||
remote_inbox: TapisRemoteInbox | ||
after: ActionFilter = None | ||
|
||
@validator("jobs") | ||
def one_or_more_jobs(cls, value): | ||
# Check that the pipeline contains at least 1 tapis job definition | ||
if len(value) < 1: | ||
raise ValueError("A Tapis ETL pipeline must contain at least 1 Tapis Job definition") | ||
|
||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.