Skip to content

Commit

Permalink
rename api/ctl* to api/client*, fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoxos committed Oct 4, 2024
1 parent 65b6b39 commit c2d6609
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
9 changes: 5 additions & 4 deletions mupifDB/api/ctl.py → mupifDB/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from rich import print_json
from rich.pretty import pprint

from . import ctl_granta as granta
from .ctl_granta import if_granta
from .ctl_util import *
from . import client_granta as granta
from .client_granta import if_granta
from .client_util import *


# --------------------------------------------------
Expand All @@ -28,8 +28,9 @@


@if_granta([])
@pydantic.validate_call
def getUsecaseRecords():
return [rec for rec in rGet("usecases/").json()]
return [models.Usercase_Model.model_validate(rec) for rec in rGet("usecases/").json()]

@if_granta(None)
def getUsecaseRecord(ucid):
Expand Down
2 changes: 1 addition & 1 deletion mupifDB/api/ctl_granta.py → mupifDB/api/client_granta.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from requests_oauthlib import OAuth2Session
from requests.auth import HTTPBasicAuth

from .ctl_util import rGet, rPost, rPatch, rPut, rDelete, api_type
from .client_util import rGet, rPost, rPatch, rPut, rDelete, api_type
from .. import table_structures, models

granta_credentials = {'username': '', 'password': ''}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mupifDB/restApiControl.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# kept for backwards compatibility only, remove later
from .api.ctl import *
from .api.client import *
16 changes: 8 additions & 8 deletions mupifDB/workflowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import tempfile
import re
from ast import literal_eval
from mupifDB.api import ctl as restApiControl
from mupifDB.api import ctl_granta
from mupifDB.api import client as restApiControl
from mupifDB.api import client_granta
import Pyro5
import mupif

Expand All @@ -18,7 +18,7 @@

import table_structures

from mupifDB.api.ctl_util import api_type
from mupifDB.api.client_util import api_type

daemon = None
def getDaemon():
Expand Down Expand Up @@ -492,7 +492,7 @@ def mapInput(app, eid, name, obj_id, app_obj_id, object_type, data_id, linked_ou
inp_record = restApiControl.getExecutionInputRecordItem(eid, name, obj_id)

if api_type == 'granta':
inp_record = ctl_granta._getGrantaExecutionInputItem(eid, name)
inp_record = client_granta._getGrantaExecutionInputItem(eid, name)

op = inp_record.get('EDMPath', None)
if op is not None:
Expand Down Expand Up @@ -750,7 +750,7 @@ def mapInputs(app, eid):
workflow = restApiControl.getWorkflowRecordGeneral(execution.WorkflowID, execution.WorkflowVersion)
workflow_input_templates = workflow.IOCard.Inputs
if api_type == 'granta':
workflow_input_templates = ctl_granta._getGrantaWorkflowMetadataFromDatabase(execution.WorkflowID.Inputs)
workflow_input_templates = client_granta._getGrantaWorkflowMetadataFromDatabase(execution.WorkflowID.Inputs)

for input_template in workflow_input_templates:
print("Mapping input " + str(input_template))
Expand Down Expand Up @@ -1130,7 +1130,7 @@ def mapOutputs(app, eid, time):
workflow = restApiControl.getWorkflowRecordGeneral(execution.WorkflowID, execution.WorkflowVersion)
workflow_output_templates = workflow.IOCard.Outputs
if api_type == 'granta':
workflow_output_templates = ctl_granta._getGrantaWorkflowMetadataFromDatabase(execution['WorkflowID']).get('Outputs', [])
workflow_output_templates = client_granta._getGrantaWorkflowMetadataFromDatabase(execution['WorkflowID']).get('Outputs', [])

granta_output_data = []

Expand Down Expand Up @@ -1158,7 +1158,7 @@ def mapOutputs(app, eid, time):

for oid in objID:
if api_type == 'granta':
output = ctl_granta._getGrantaOutput(
output = client_granta._getGrantaOutput(
app=app,
eid=eid,
name=name,
Expand Down Expand Up @@ -1195,5 +1195,5 @@ def mapOutputs(app, eid, time):
)

if api_type == 'granta':
ctl_granta._setGrantaExecutionResults(eid, granta_output_data)
client_granta._setGrantaExecutionResults(eid, granta_output_data)

0 comments on commit c2d6609

Please sign in to comment.