Skip to content

Commit

Permalink
Fix serialization of integrity profile
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Apr 18, 2024
1 parent 3cdacc4 commit 9513f21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/api/src/backend/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ def executor_request_is_valid(request):
return True

def build_etl_pipeline_env(body):
# Convert the data integrity policies to dicts. Easier
# to handle for null values via .get
local_inbox_data_integrity_profile = {}
if getattr(body.local_inbox.data, "integrity_profile", None) != None:
# Convert the data integrity policies to dicts. Easier to handle for null
# Svalues via .get
local_inbox_data_integrity_profile = body.local_inbox.data.integrity_profile
if body.local_inbox.data.integrity_profile != None:
local_inbox_data_integrity_profile = body.local_inbox.data.integrity_profile.dict()

local_outbox_data_integrity_profile = {}
if getattr(body.local_outbox.data, "integrity_profile", None) != None:
local_outbox_data_integrity_profile = body.local_outbox.data.integrity_profile
if body.local_outbox.data.integrity_profile != None:
local_outbox_data_integrity_profile = body.local_outbox.data.integrity_profile.dict()

remote_inbox_data_integrity_profile = {}
if getattr(body.remote_inbox.data, "integrity_profile", None) != None:
remote_inbox_data_integrity_profile = body.remote_inbox.data.integrity_profile
if body.remote_inbox.data.integrity_profile != None:
remote_inbox_data_integrity_profile = body.remote_inbox.data.integrity_profile.dict()

remote_outbox_data_integrity_profile = {}
if getattr(body.remote_outbox.data, "integrity_profile", None) != None:
remote_outbox_data_integrity_profile = body.remote_outbox.data.integrity_profile
if body.remote_outbox.data.integrity_profile != None:
remote_outbox_data_integrity_profile = body.remote_outbox.data.integrity_profile.dict()

body.local_inbox.data.integrity_profile = local_inbox_data_integrity_profile
Expand Down
13 changes: 3 additions & 10 deletions src/api/src/backend/views/http/tapis_etl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Dict
from typing import List, Dict, Literal

from pydantic import BaseModel, Extra, conlist

Expand Down Expand Up @@ -72,6 +72,7 @@ class TapisJobDef(BaseModel):

class TapisETLExtension(BaseModel):
env_mappings: Dict[str, str] = {}
last_status: str = "PENDING"

class TapisJobExtensions(BaseModel):
tapis_etl: TapisETLExtension = TapisETLExtension()
Expand All @@ -95,12 +96,4 @@ class TapisETLPipeline(Pipeline):
jobs: List[ExetendedTapisJob] = []
local_outbox: LocalOutbox
remote_inbox: RemoteInbox
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
after: ActionFilter = None

0 comments on commit 9513f21

Please sign in to comment.