|
19 | 19 |
|
20 | 20 | package org.commonwl.view.cwl; |
21 | 21 |
|
| 22 | +import java.io.IOException; |
| 23 | +import java.nio.file.Path; |
| 24 | +import java.util.Date; |
22 | 25 | import org.apache.jena.query.QueryException; |
23 | 26 | import org.commonwl.view.git.GitDetails; |
24 | 27 | import org.commonwl.view.git.GitLicenseException; |
|
31 | 34 | import org.commonwl.view.workflow.Workflow; |
32 | 35 | import org.commonwl.view.workflow.WorkflowRepository; |
33 | 36 | import org.eclipse.jgit.api.Git; |
| 37 | +import org.eclipse.jgit.errors.MissingObjectException; |
| 38 | +import org.eclipse.jgit.errors.TransportException; |
34 | 39 | import org.slf4j.Logger; |
35 | 40 | import org.slf4j.LoggerFactory; |
36 | 41 | import org.springframework.beans.factory.annotation.Autowired; |
37 | 42 | import org.springframework.scheduling.annotation.Async; |
38 | 43 | import org.springframework.scheduling.annotation.EnableAsync; |
39 | 44 | import org.springframework.stereotype.Component; |
40 | 45 |
|
41 | | -import java.io.IOException; |
42 | | -import java.nio.file.Path; |
43 | | -import java.util.Date; |
44 | | - |
45 | | -/** |
46 | | - * Replace an existing workflow with the one given by cwltool |
47 | | - */ |
| 46 | +/** Replace an existing workflow with the one given by cwltool */ |
48 | 47 | @Component |
49 | 48 | @EnableAsync |
50 | 49 | public class CWLToolRunner { |
@@ -114,13 +113,47 @@ public void createWorkflowFromQueued(QueuedWorkflow queuedWorkflow) throws IOExc |
114 | 113 | FileUtils.deleteGitRepository(repo); |
115 | 114 | } catch (CWLValidationException | GitLicenseException ex) { |
116 | 115 | String message = ex.getMessage(); |
117 | | - logger.error("Workflow {} from {} : {}", queuedWorkflow.getId(), gitInfo.toSummary(), message, ex); |
| 116 | + logger.error( |
| 117 | + "Workflow {} from {} : {}", queuedWorkflow.getId(), gitInfo.toSummary(), message, ex); |
118 | 118 | queuedWorkflow.setCwltoolStatus(CWLToolStatus.ERROR); |
119 | 119 | queuedWorkflow.setMessage(message); |
120 | 120 | FileUtils.deleteGitRepository(repo); |
| 121 | + } catch (TransportException ex) { |
| 122 | + String message = ex.getMessage(); |
| 123 | + logger.error( |
| 124 | + "Workflow retrieval error while processing {} from {} : {}", |
| 125 | + queuedWorkflow.getId(), |
| 126 | + gitInfo.toSummary(), |
| 127 | + message, |
| 128 | + ex); |
| 129 | + queuedWorkflow.setCwltoolStatus(CWLToolStatus.ERROR); |
| 130 | + if (message.contains( |
| 131 | + "Authentication is required but no CredentialsProvider has been registered")) { |
| 132 | + queuedWorkflow.setMessage( |
| 133 | + "Unable to retrieve the Git repository: it may be private, misnamed, or removed. " |
| 134 | + + message); |
| 135 | + } else { |
| 136 | + queuedWorkflow.setMessage(message); |
| 137 | + } |
| 138 | + FileUtils.deleteGitRepository(repo); |
| 139 | + } catch (MissingObjectException ex) { |
| 140 | + String message = ex.getMessage(); |
| 141 | + logger.error( |
| 142 | + "Workflow retrieval error while processing {} from {} : {}", |
| 143 | + queuedWorkflow.getId(), |
| 144 | + gitInfo.toSummary(), |
| 145 | + message, |
| 146 | + ex); |
| 147 | + queuedWorkflow.setCwltoolStatus(CWLToolStatus.ERROR); |
| 148 | + queuedWorkflow.setMessage("Unable to retrieve a needed Git object: " + message); |
| 149 | + FileUtils.deleteGitRepository(repo); |
121 | 150 | } catch (Exception ex) { |
122 | | - logger.error("Unexpected error processing workflow {} from {} : {}", |
123 | | - queuedWorkflow.getId(), gitInfo.toSummary(), ex.getMessage(), ex); |
| 151 | + logger.error( |
| 152 | + "Unexpected error processing workflow {} from {} : {}", |
| 153 | + queuedWorkflow.getId(), |
| 154 | + gitInfo.toSummary(), |
| 155 | + ex.getMessage(), |
| 156 | + ex); |
124 | 157 | queuedWorkflow.setCwltoolStatus(CWLToolStatus.ERROR); |
125 | 158 | queuedWorkflow.setMessage( |
126 | 159 | "Whoops! Cwltool ran successfully, but an unexpected " |
|
0 commit comments