Skip to content

Commit

Permalink
update documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
uhbrar committed Nov 25, 2024
1 parent 385c751 commit d3ea3ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Workflow runner

Workflow Runner is a tool that utlizes the Operations and Workflows language to perform queries. A request can be sent to the service containing a TRAPI message and workflow. Workflow Runner will then perform all of the operations included in the workflow on the message. Workflows are defined sequentially, so each operation is performed on the result message of the operation directly preceeding it.

Workflow Runner is dependent on operation providers, which are the services that are able to perform each operation. These operation providers are discoverd through SmartAPI registry, and require services to self report which operations they support. The list of operation providers can be found through the /services endpoint.

A complete list of operations can be found here: https://github.com/NCATSTranslator/OperationsAndWorkflows?tab=readme-ov-file

## deployment

### Live service
Expand Down
5 changes: 5 additions & 0 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,21 @@ async def run_workflow(
logger.setLevel(logging._nameToLevel[log_level])
completed_workflow = []

# Run operations in workflow sequentially, using output from one operation as input for next
for operation in workflow:
operation_services = []
runner_parameters = operation.pop("runner_parameters", {})
operation_timeout = runner_parameters.get("timeout", 60.0)
async with httpx.AsyncClient(verify=False, timeout=operation_timeout) as client:
# If allowlist included, only use those services
if "allowlist" in runner_parameters.keys():
for service in SERVICES.get(operation["id"], []):
if service["infores"] in runner_parameters["allowlist"]:
operation_services.append(service)
else:
for service in SERVICES.get(operation["id"], []):
operation_services.append(service)
# Don't use anything in the denylist
if "denylist" in runner_parameters.keys():
for service in operation_services:
if service["infores"] in runner_parameters["denylist"]:
Expand All @@ -131,6 +134,7 @@ async def run_workflow(

service_operation_responses = []

# Run operation on each operation provider
for service in operation_services:
url = service["url"]
service_name = service["title"]
Expand All @@ -152,6 +156,7 @@ async def run_workflow(
)
logger.debug(f"Received operation '{operation}' from {service_name}...")

# Normalize responses so we can merge
try:
response = await post_safely(
NORMALIZER_URL + "/query",
Expand Down

0 comments on commit d3ea3ee

Please sign in to comment.