Revision 37409
Added by Michele Artini almost 9 years ago
modules/dnet-manager-service/trunk/src/main/java/eu/dnetlib/msro/dispatcher/WorkflowRegistry.java | ||
---|---|---|
11 | 11 |
import com.google.common.collect.Maps; |
12 | 12 |
|
13 | 13 |
import eu.dnetlib.enabling.datastructures.MetaWorkflow; |
14 |
import eu.dnetlib.miscutils.DateUtils; |
|
14 | 15 |
|
15 | 16 |
public class WorkflowRegistry { |
16 | 17 |
|
... | ... | |
22 | 23 |
|
23 | 24 |
public ProcessInfo registerProcess(final String wfName, final MetaWorkflow metaWf) { |
24 | 25 |
final String procId = generateProcessId(); |
25 |
final ProcessInfo info = new ProcessInfo(procId, metaWf.getCode(), wfName, metaWf.getFamily(), metaWf.getDatasourceName()); |
|
26 |
final ProcessInfo info = new ProcessInfo(procId, metaWf.getCode(), wfName, metaWf.getFamily(), metaWf.getDatasourceName(), DateUtils.now());
|
|
26 | 27 |
procs.put(procId, info); |
27 | 28 |
return info; |
28 | 29 |
} |
modules/dnet-manager-service/trunk/src/main/java/eu/dnetlib/msro/dispatcher/ProcessInfo.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
private String workerId; |
14 | 14 |
private String currentNode; |
15 |
private long startDate; |
|
15 | 16 |
private long lastActivityDate; |
16 | 17 |
private BlackboardActionStatus status = BlackboardActionStatus.ASSIGNED; |
17 | 18 |
|
18 |
public ProcessInfo(final String procId, final String metaWfId, final String wfName, final String family, final String repoName) { |
|
19 |
public ProcessInfo(final String procId, final String metaWfId, final String wfName, final String family, final String repoName, final long startDate) {
|
|
19 | 20 |
this.procId = procId; |
20 | 21 |
this.metaWfId = metaWfId; |
21 | 22 |
this.wfName = wfName; |
22 | 23 |
this.family = family; |
23 | 24 |
this.repoName = repoName; |
25 |
this.startDate = startDate; |
|
24 | 26 |
} |
25 | 27 |
|
26 | 28 |
public final String getWorkerId() { |
... | ... | |
95 | 97 |
this.family = family; |
96 | 98 |
} |
97 | 99 |
|
100 |
public long getStartDate() { |
|
101 |
return startDate; |
|
102 |
} |
|
103 |
|
|
104 |
public void setStartDate(final long startDate) { |
|
105 |
this.startDate = startDate; |
|
106 |
} |
|
107 |
|
|
98 | 108 |
} |
modules/dnet-modular-workflows-ui/branches/newManagerService/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/WorkflowsController.java | ||
---|---|---|
83 | 83 |
final String metaWfId = input.get(WorkflowConstants.SYSTEM_METAWF_ID); |
84 | 84 |
final String family = input.get(WorkflowConstants.SYSTEM_WF_PROFILE_FAMILY); |
85 | 85 |
final long date = NumberUtils.toLong(input.get(LogMessage.LOG_DATE_FIELD), 0); |
86 |
final long startDate = NumberUtils.toLong(input.get(WorkflowConstants.SYSTEM_START_DATE), 0); |
|
86 | 87 |
final BlackboardActionStatus status = Boolean.valueOf(input.get(WorkflowConstants.SYSTEM_COMPLETED_SUCCESSFULLY)) ? BlackboardActionStatus.DONE |
87 | 88 |
: BlackboardActionStatus.FAILED; |
88 | 89 |
|
89 |
final ProcessInfo info = new ProcessInfo(metaWfId, name, repo, family, procId); |
|
90 |
final ProcessInfo info = new ProcessInfo(metaWfId, name, repo, family, procId, startDate);
|
|
90 | 91 |
info.setLastActivityDate(date); |
91 | 92 |
info.setStatus(status); |
92 | 93 |
|
... | ... | |
321 | 322 |
Map<String, Object> getWfJournalLog(@RequestParam(value = "proc", required = true) final String procId) throws Exception { |
322 | 323 |
final Map<String, Object> res = Maps.newHashMap(); |
323 | 324 |
|
325 |
res.put("procId", procId); |
|
326 |
|
|
324 | 327 |
final Map<String, String> logs = dnetLogger.findOne("system:processId", procId); |
325 | 328 |
|
326 | 329 |
if (logs != null && !logs.isEmpty()) { |
... | ... | |
340 | 343 |
final ProcessInfo process = wfRegistry.findProcess(procId); |
341 | 344 |
|
342 | 345 |
if (process != null) { |
346 |
res.put("name", process.getWfName()); |
|
347 |
res.put("worker", process.getWorkerId()); |
|
348 |
res.put("startDate", process.getStartDate()); |
|
349 |
if (process.getStatus() == BlackboardActionStatus.DONE || process.getStatus() == BlackboardActionStatus.FAILED) { |
|
350 |
res.put("endDate", process.getLastActivityDate()); |
|
351 |
} else { |
|
352 |
res.put("endDate", 0); |
|
353 |
} |
|
354 |
|
|
343 | 355 |
if (process.getStatus() != BlackboardActionStatus.ASSIGNED) { |
344 | 356 |
final ProcessImageDesc desc = processGraphGenerator.getProcessImageDesc(procId); |
345 | 357 |
if (desc != null) { |
modules/dnet-modular-workflows-ui/branches/newManagerService/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows/common/wf_monitor_proc.st | ||
---|---|---|
4 | 4 |
<div class="modal-header"> |
5 | 5 |
<button type="button" class="close" data-dismiss="modal">×</button> |
6 | 6 |
<h4 class="modal-title"> |
7 |
Process {{currentProc.wfId}} ({{currentProc.name}})
|
|
7 |
Process {{currentProc.procId}} ({{currentProc.name}})
|
|
8 | 8 |
<span style="margin-left:10px" class="label" ng-class="{'label-success': currentProc.status == 'SUCCESS', 'label-danger': currentProc.status == 'FAILURE', 'label-info': currentProc.status == 'EXECUTING'}">{{currentProc.status}}</span> |
9 | 9 |
</h4> |
10 | 10 |
</div> |
Also available in: Unified diff
WF start and end date