galaxyproject/blend4j

Workflow execution throws exception

Opened this issue · 5 comments

Executing a workflow according to the example in the JavaDocs no longer seem to work correctly.
The WorkflowsClientImpl.runWorkflow() call results in the following Exception:

Exception in thread "main" GalaxyResponseException{status=500, responseBody={"err_msg": "Uncaught exception in exposed API method:", "err_code": 0}, errorMessage=Uncaught exception in exposed API method:, errorCode=0, traceback=null}
	at com.github.jmchilton.blend4j.galaxy.Client.buildResponseException(Client.java:18)
	at com.github.jmchilton.blend4j.BaseClient.checkResponse(BaseClient.java:138)
	at com.github.jmchilton.blend4j.BaseClient.create(BaseClient.java:47)
	at com.github.jmchilton.blend4j.BaseClient.create(BaseClient.java:36)
	at com.github.jmchilton.blend4j.BaseClient.create(BaseClient.java:32)
	at com.github.jmchilton.blend4j.galaxy.WorkflowsClientImpl.runWorkflowResponse(WorkflowsClientImpl.java:38)
	at com.github.jmchilton.blend4j.galaxy.WorkflowsClientImpl.runWorkflow(WorkflowsClientImpl.java:42)

Despite this the workflow does start, but the particular workflow involved here does not complete fully. Some jobs simply fail to run, even though the same workflow runs fine through the GUI or with bioblend (using the same inputs). This could be a separate problem, but first need to get the WorkflowsClientImpl.runWorkflow() call working correctly.

Hi @tdudgeon, which version of Galaxy are you running this against?

usegalaxy.eu on 17 Dec.
I always fail to work out what exact version that is from the galaxy UI.
I tried quite hard couldn't find it.

@dfornika happy to provide you with more information about usegalaxy.eu setup if needed. This is running 19.09 atm.

Just pasting the example from the javadocs here for reference:

The following code demonstrates running a workflow. It assumes the existence of a workflow named TestWorkflow1 with two inputs labeled WorkflowInput1 and WorkflowInput2. Additionally it assumes a history named TestHistory1 already exists containing two datasets Input1 and Input2.

final GalaxyInstance instance = GalaxyInstanceFactory.get(url, apiKey);
final WorkflowsClient workflowsClient = instance.getWorkflowsClient();
 
// Find history
final HistoriesClient historyClient = instance.getHistoriesClient();
History matchingHistory = null;
for(final History history : historyClient.getHistories()) {
  if(history.getName().equals("TestHistory1")) {
    matchingHistory = history;
  }
}
Assert.assertNotNull(matchingHistory);
String input1Id = null;
String input2Id = null;
for(final HistoryContents historyDataset :historyClient.showHistoryContents(matchingHistory.getId())) {
  if(historyDataset.getName().equals("Input1")) {
    input1Id = historyDataset.getId();
  }
  if(historyDataset.getName().equals("Input2")) {
    input2Id = historyDataset.getId();
  }
}
 
Workflow matchingWorkflow = null;
for(Workflow workflow : workflowsClient.getWorkflows()) {
  if(workflow.getName().equals("TestWorkflow1")) {
    matchingWorkflow = workflow;
  }
}
 
final WorkflowDetails workflowDetails = workflowsClient.showWorkflow(matchingWorkflow.getId());
String workflowInput1Id = null;
String workflowInput2Id = null;
for(final Map.Entry<String, WorkflowInputDefinition> inputEntry : workflowDetails.getInputs().entrySet()) {
  final String label = inputEntry.getValue().getLabel();
  if(label.equals("WorkflowInput1")) {
    workflowInput1Id = inputEntry.getKey();
  }
  if(label.equals("WorkflowInput2")) {
    workflowInput2Id = inputEntry.getKey();
  }
}
 
final WorkflowInputs inputs = new WorkflowInputs();
inputs.setDestination(new WorkflowInputs.ExistingHistory(matchingHistory.getId()));
inputs.setWorkflowId(matchingWorkflow.getId());
inputs.setInput(workflowInput1Id, new WorkflowInputs.WorkflowInput(input1Id, WorkflowInputs.InputSourceType.HDA));
inputs.setInput(workflowInput2Id, new WorkflowInputs.WorkflowInput(input2Id, WorkflowInputs.InputSourceType.HDA));
final WorkflowOutputs output = workflowsClient.runWorkflow(inputs);    
System.out.println("Running workflow in history " + output.getHistoryId());
for(String outputId : output.getOutputIds()) {
  System.out.println("  Workflow writing to output id " + outputId);
}

I've set up a repo to reproduce this issue here:

https://github.com/dfornika/blend4j-reproduce-issue-40

The blend4j docs don't specify exactly what the workflow does. For my test, I just concatenated two tabular input files. The test is passing against Galaxy versions 18.09, 19.01 and 19.05.1 (using the galaxy-stable docker image. Version 19.09 isn't available for the docker image yet.

@tdudgeon Could you post the workflow that you were using when you ran into this error?