Skip to content

Commit

Permalink
establish run() function again
Browse files Browse the repository at this point in the history
  • Loading branch information
ascourtas committed May 4, 2022
1 parent 98690ff commit 1e91dcd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions foundry/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# from dlhub_sdk.utils.schemas import validate_against_dlhub_schema
# from dlhub_sdk.models.servables.keras import KerasModel
# from dlhub_sdk.models.servables.sklearn import ScikitLearnModel
# from dlhub_sdk import DLHubClient
from dlhub_sdk import DLHubClient
from collections import namedtuple
from joblib import Parallel, delayed
from pydantic import AnyUrl, ValidationError
Expand All @@ -43,7 +43,7 @@ class Foundry(FoundryMetadata):
"""

# transfer_client: Any
# dlhub_client: Any
dlhub_client: Any
forge_client: Any
connect_client: Any
index = ""
Expand Down Expand Up @@ -110,15 +110,15 @@ def __init__(
)

## TODO: come back to add in DLHub functionality after globus-sdk>=3.0 supported
# self.dlhub_client = DLHubClient(
# dlh_authorizer=auths["dlhub"],
# search_client=auths["search"],
# fx_authorizer=auths[
# "https://auth.globus.org/scopes/facd7ccc-c5f4-42aa-916b-a0e270e2c2a9/all"
# ],
# openid_authorizer=auths['openid'],
# force_login=False,
# )
self.dlhub_client = DLHubClient(
dlh_authorizer=auths["dlhub"],
search_client=auths["search"],
fx_authorizer=auths[
"https://auth.globus.org/scopes/facd7ccc-c5f4-42aa-916b-a0e270e2c2a9/all"
],
openid_authorizer=auths['openid'],
force_login=False,
)


self.xtract_tokens = {
Expand Down Expand Up @@ -266,22 +266,18 @@ def collect_dataframes(self, packages=[]):

return pd.concat(X_frames), pd.concat(y_frames)

# def run(self, name, inputs, **kwargs):
# """Run a model on data
#
# Args:
# name (str): DLHub model name
# inputs: Data to send to DLHub as inputs (should be JSON serializable)
#
# Returns
# -------
# Returns results after invocation via the DLHub service
#
# TODO:
# -------
# - Pass **kwargs through to DLHub client and document kwargs
# """
# return self.dlhub_client.run(name, inputs=inputs)
def run(self, name, inputs, **kwargs):
"""Run a model on data
Args:
name (str): DLHub model name
inputs: Data to send to DLHub as inputs (should be JSON serializable)
Returns
-------
Returns results after invocation via the DLHub service
"""
return self.dlhub_client.run(name, inputs=inputs, **kwargs)

def load_data(self, source_id=None, globus=True):
"""Load in the data associated with the prescribed dataset
Expand Down
Empty file added test.py
Empty file.

0 comments on commit 1e91dcd

Please sign in to comment.