Exemplo n.º 1
0
def submit_workflow_from_catalog(bucket_name,
                                 workflow_name,
                                 workflow_variables={},
                                 token=""):
    result = False
    try:
        log("[INFO] Connecting on " + proactive_url, token)
        gateway = proactive.ProActiveGateway(proactive_url, [])
        gateway.connect(username=user_credentials['ciLogin'],
                        password=user_credentials['ciPasswd'])
        if gateway.isConnected():
            log("[INFO] Connected to " + proactive_url, token)
            try:
                log("[INFO] Submitting a workflow from the catalog", token)
                jobId = gateway.submitWorkflowFromCatalog(
                    bucket_name, workflow_name, workflow_variables)
                assert jobId is not None
                assert isinstance(jobId, numbers.Number)
                workflow_path = bucket_name + "/" + workflow_name
                log(
                    "[INFO] Workflow " + workflow_path +
                    " submitted successfully with jobID: " + str(jobId), token)
                result = True
            finally:
                log("[INFO] Disconnecting from " + proactive_url, token)
                gateway.disconnect()
                log("[INFO] Disconnected from " + proactive_url, token)
                gateway.terminate()
                log("[INFO] Connection finished from " + proactive_url, token)
        else:
            log("[INFO] Couldn't connect to " + proactive_url, token)
    except Exception as e:
        log("[ERROR] Error while connecting on " + proactive_url, token)
        log(str(e), token)
    return result
Exemplo n.º 2
0
import os
import getpass
import proactive

print("Logging on proactive-server...")
proactive_host = 'try.activeeon.com'
proactive_port = '8080'
proactive_url = "http://" + proactive_host + ":" + proactive_port
print("Connecting on: " + proactive_url)
javaopts = []
# uncomment for detailed logs
# javaopts.append('-Dlog4j.configuration=file:'+os.path.join(os.getcwd(),'log4j.properties'))
redirectJVMOutput = False
gateway = proactive.ProActiveGateway(proactive_url, javaopts,
                                     redirectJVMOutput)

gateway.connect(username="", password="")  # put your login here!
# Or uncomment the following line to protect your password
# gateway.connect(username="", password=getpass.getpass(prompt='Password: '******'param_a', 'param_b'])
    # proactive_task.setTaskImplementationFromFile('main.py', ['param_1', 'param_2'])
    # proactive_task.addInputFile('scripts/__init__.py')
 def setup_gateway(self, metadata):
     self.gateway = proactive.ProActiveGateway(metadata['proactive_url'], debug=True)
     self.username = metadata['username']
     self.password = metadata['password']