Project

General

Profile

« Previous | Next » 

Revision 37498

last execution date in wfi

View differences:

modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/datastructures/WorkflowInstance.java
15 15
		UNKNOWN, CONFIGURED, NOT_CONFIGURED
16 16
	}
17 17

  
18
	public enum LastExecutionStatus {
19
		UNKNOWN, SUCCESS, FAILED
20
	}
21

  
18 22
	private String wfCode;
19 23
	private String wfName;
20 24
	private Map<String, String> params;
21 25
	private StartMode startMode = StartMode.AUTO;
22 26
	private ConfigurationStatus configurationStatus = ConfigurationStatus.UNKNOWN;
23 27
	private Set<WorkflowInstance> children = Sets.newHashSet();
28
	private long lastExecutionDate = 0;
29
	private LastExecutionStatus lastExecutionStatus = LastExecutionStatus.UNKNOWN;
24 30

  
25 31
	public WorkflowInstance() {}
26 32

  
......
83 89
		this.configurationStatus = configurationStatus;
84 90
	}
85 91

  
92
	public final long getLastExecutionDate() {
93
		return lastExecutionDate;
94
	}
95

  
96
	public final void setLastExecutionDate(final long lastExecutionDate) {
97
		this.lastExecutionDate = lastExecutionDate;
98
	}
99

  
100
	public final LastExecutionStatus getLastExecutionStatus() {
101
		return lastExecutionStatus;
102
	}
103

  
104
	public final void setLastExecutionStatus(final LastExecutionStatus lastExecutionStatus) {
105
		this.lastExecutionStatus = lastExecutionStatus;
106
	}
107

  
86 108
}
modules/dnet-manager-service/trunk/src/main/java/eu/dnetlib/msro/dispatcher/WorkflowDispatcher.java
14 14
import eu.dnetlib.enabling.datastructures.MetaWorkflow;
15 15
import eu.dnetlib.enabling.datastructures.Workflow;
16 16
import eu.dnetlib.enabling.datastructures.WorkflowInstance;
17
import eu.dnetlib.enabling.datastructures.WorkflowInstance.LastExecutionStatus;
17 18
import eu.dnetlib.enabling.is.client.InformationServiceClient;
18 19
import eu.dnetlib.miscutils.DateUtils;
19 20
import eu.dnetlib.rmi.blackboard.LaunchWorkflowMessage;
20 21
import eu.dnetlib.rmi.objects.is.BlackboardActionStatus;
22
import eu.dnetlib.rmi.soap.exceptions.InformationServiceException;
21 23
import eu.dnetlib.rmi.soap.exceptions.ManagerServiceException;
22 24

  
23 25
public class WorkflowDispatcher {
......
85 87

  
86 88
						@Override
87 89
						public void onSuccess(final LaunchWorkflowMessage m) {
90
							final long now = DateUtils.now();
88 91
							info.setStatus(BlackboardActionStatus.DONE);
89 92
							info.setCurrentNode(m.getCurrentNode());
90
							info.setLastActivityDate(DateUtils.now());
93
							info.setLastActivityDate(now);
94
							updateMetaWf(metaWf.getCode(), wfName, LastExecutionStatus.SUCCESS, now);
91 95
							System.out.println("***** SUCCESS: " + m.getProcId() + " - " + m.getCurrentNode());
92 96
						}
93 97

  
94 98
						@Override
95 99
						public void onFail(final LaunchWorkflowMessage m) {
100
							final long now = DateUtils.now();
96 101
							info.setStatus(BlackboardActionStatus.FAILED);
97 102
							info.setCurrentNode(m.getCurrentNode());
98
							info.setLastActivityDate(DateUtils.now());
103
							info.setLastActivityDate(now);
104
							updateMetaWf(metaWf.getCode(), wfName, LastExecutionStatus.FAILED, now);
99 105
							System.out.println("***** FAIL: " + m.getError() + " - " + m.getCurrentNode());
100 106
						}
101 107

  
......
116 122
			throw new ManagerServiceException("Error dispatching wf", e);
117 123
		}
118 124
	}
125

  
126
	synchronized private void updateMetaWf(final String metaWfId, final String wfName, final LastExecutionStatus status, final long now) {
127
		try {
128
			final MetaWorkflow metaWf = isClient.getResourceByCode(metaWfId, MetaWorkflow.class);
129
			final WorkflowInstance wfi = metaWf.findWorkflowInstanceByName(wfName);
130
			wfi.setLastExecutionStatus(status);;
131
			wfi.setLastExecutionDate(now);
132
			isClient.updateResource(metaWf);
133
		} catch (InformationServiceException e) {
134
			log.error("Error updateMetaWf: " + metaWfId);
135
			throw new RuntimeException("Error updateMetaWf: " + metaWfId, e);
136
		}
137
	}
119 138
}
modules/dnet-modular-workflows-ui/branches/newManagerService/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows/simple/metawf.st
47 47
										<span ng-hide="wf.date" class="muted" style="white-space: nowrap">not yet executed</span>
48 48
									</td><td class="text-center">
49 49
										<span class="label label-success" ng-show="wf.status == 'SUCCESS'">SUCCESS</span>
50
										<span class="label label-danger" ng-show="wf.status == 'FAILURE'">FAILURE</span>
51
										<span ng-hide="wf.status == 'FAILURE' || wf.status == 'FAILURE'">-</span>
50
										<span class="label label-danger" ng-show="wf.status == 'FAILED'">FAILED</span>
51
										<span ng-hide="wf.status == 'SUCCESS' || wf.status == 'FAILED'">-</span>
52 52
									</td>
53 53
									<td class="text-center">
54 54
										<div class="btn-group text-left">
modules/dnet-modular-workflows-ui/branches/newManagerService/src/main/resources/eu/dnetlib/web/resources/js/dnet_workflows_common.js
163 163
				'space'      : space,
164 164
				'code'       : wfi.wfCode,
165 165
				'name'       : wfi.wfName,
166
				//'date'       : wfi.date,
167
				'status'     : wfi.configurationStatus,
166
				'date'       : wfi.lastExecutionDate,
167
				'status'     : wfi.lastExecutionStatus,
168 168
				'start'      : wfi.startMode.toLowerCase(),
169 169
				'params'     : angular.extend({}, globalParams, wfi.params),
170 170
				'configured' : wfi.configurationStatus.toLowerCase() == 'configured',

Also available in: Unified diff