Skip to content
Snippets Groups Projects
Commit 8d0b3b2d authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Copied run_capability.py over from wksp0 to have as reference

parent 5fe4631e
No related branches found
No related tags found
No related merge requests found
import pathlib
from injector import Injector
import wksp.workflow as wf
import wksp.capability as cp
from wksp.ifaces import WorkflowInfo, WorkflowService, CapabilityService
import sys
def main():
if len(sys.argv) < 2:
print('Usage: run <capability name> product-locator [product-locator...]')
# for the purposes of this test, we are using
# the hardcoded workflow info and the DAGman workflow service
def configure(binder):
# binder.bind(CapabilityInfo, to=cp.DirectoryCapabilityInfo(pathlib.Path('./capabilities'))
# binder.bind(CapabilityEngineResponder, to=cp.ConsoleEngineResponder)
binder.bind(WorkflowInfo, to=wf.DirectoryWorkflowInfo(pathlib.Path('./workflows')))
binder.bind(WorkflowService, to=wf.HTCondorWorkflowService)
binder.bind(cp.CapabilityInfo, to=cp.DirectoryCapabilityInfo(pathlib.Path('./capabilities')))
binder.bind(CapabilityService, to=cp.PrototypeCapabilityService)
binder.bind(cp.ProductService, to=cp.HardcodedProductService)
binder.bind(cp.CapabilityEngine, to=cp.PrototypeCapabilityEngine)
binder.bind(cp.CapabilityEngineResponder, to=cp.PrototypeCapabilityEngineResponder)
binder.bind(cp.CapabilityQueue, to=cp.PrototypeCapabilityQueue)
# set up the injector
injector = Injector(configure)
# get the service
capability_service = injector.get(CapabilityService)
# 1. initialize the request
request = capability_service.send_request(sys.argv[1], sys.argv[2:])
# 2. execute the request
capability_service.execute(request)
# 3. while the request needs input, provide it
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment