fix start repo-hi
This commit is contained in:
parent
f4ef6847c5
commit
8df4c71cbf
|
@ -15,8 +15,8 @@ CREATE TABLE wf_journal (
|
|||
name text NOT NULL,
|
||||
family text NOT NULL,
|
||||
status text NOT NULL,
|
||||
start_date timestamp NOT NULL,
|
||||
end_date timestamp NOT NULL,
|
||||
start_date timestamp,
|
||||
end_date timestamp,
|
||||
ds_id text,
|
||||
ds_name text,
|
||||
ds_api text,
|
||||
|
|
|
@ -354,7 +354,9 @@ export class DsmAddWorkflowDialog {
|
|||
}
|
||||
|
||||
startRepoHiWf(wfId: string): void {
|
||||
this.client.dsmRepoHiWf(wfId, this.ds.id, this.ds.name, this.api.id, (data: WfHistoryEntry) => {
|
||||
alert(this.ds.officialname);
|
||||
|
||||
this.client.dsmRepoHiWf(wfId, this.ds.id, this.ds.officialname, this.api.id, (data: WfHistoryEntry) => {
|
||||
alert(data);
|
||||
this.dialogRef.close(1);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial
|
|||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { KeyValue, SimpleResource, WfConf, WfHistoryEntry, WfParam, WfProcessStatus, WfSection } from '../common/is.model';
|
||||
import { KeyValue, SimpleResource, WfConf, WfHistoryEntry, WfParam, WfSection } from '../common/is.model';
|
||||
import { ResMetadataDialog } from '../resources/resources.component';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { WfHistoryDialog } from '../wf-history/wf-history.component';
|
||||
|
@ -201,7 +201,7 @@ export class WfConfSingle implements OnInit, OnChanges {
|
|||
|
||||
launchWfConf() {
|
||||
if (this.conf?.id && this.conf?.workflow) {
|
||||
this.client.startWfConfiguration(this.conf?.id, (data: WfProcessStatus) => this.snackBar.open('Workflow launched !!!', 'INFO', { duration: 5000 }));
|
||||
this.client.startWfConfiguration(this.conf?.id, (data: WfHistoryEntry) => this.snackBar.open('Workflow launched !!!', 'INFO', { duration: 5000 }));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ export class WfConfSingle implements OnInit, OnChanges {
|
|||
deleteConf() {
|
||||
if (this.conf?.destroyWf) {
|
||||
if (this.conf?.id && this.conf?.workflow) {
|
||||
this.client.startDestroyWfConfiguration(this.conf?.id, (data: WfProcessStatus) => this.snackBar.open('Destroy Workflow launched, PLEASE WAIT !!!', 'INFO', { duration: 5000 }));
|
||||
this.client.startDestroyWfConfiguration(this.conf?.id, (data: WfHistoryEntry) => this.snackBar.open('Destroy Workflow launched, PLEASE WAIT !!!', 'INFO', { duration: 5000 }));
|
||||
}
|
||||
} else if (this.conf?.id) {
|
||||
this.client.deleteWfConfiguration(this.conf?.id, (data: void) => {
|
||||
|
|
|
@ -14,9 +14,11 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import eu.dnetlib.common.app.ServiceStatusRegistry;
|
||||
import eu.dnetlib.common.clients.DnetServiceClientFactory;
|
||||
import eu.dnetlib.common.clients.SimpleResourceClient;
|
||||
import eu.dnetlib.domain.resource.SimpleResource;
|
||||
import eu.dnetlib.domain.service.ServiceStatus;
|
||||
import eu.dnetlib.domain.wfs.JobStatus;
|
||||
import eu.dnetlib.domain.wfs.WfConfiguration;
|
||||
import eu.dnetlib.domain.wfs.WfJournalEntry;
|
||||
|
@ -63,25 +65,24 @@ public class WfExecutorService implements Stoppable {
|
|||
@Value("${dnet.wf.procs.size:20}")
|
||||
private int maxSize;
|
||||
|
||||
private final String executorId;
|
||||
|
||||
public WfExecutorService() {
|
||||
executorId = "wf-exec-" + UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
|
||||
public synchronized void startWorkflow() throws Exception {
|
||||
if (isPaused() || (processRegistry.countRunningWfs() >= maxSize)) {}
|
||||
|
||||
for (final WfJournalEntry job : wfJournalEntryRepository.findByStatus(JobStatus.pending)) {
|
||||
if ((processRegistry.countRunningWfs() < maxSize) && tryAssegnment(job)) {
|
||||
startWorkflowJob(job);
|
||||
final ServiceStatus status = ServiceStatusRegistry.getStatus();
|
||||
|
||||
if ((status != null) && StringUtils.isNotBlank(status.getName())) {
|
||||
for (final WfJournalEntry job : wfJournalEntryRepository.findByStatus(JobStatus.pending)) {
|
||||
if ((processRegistry.countRunningWfs() < maxSize) && tryAssegnment(job, status.getName())) {
|
||||
startWorkflowJob(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tryAssegnment(final WfJournalEntry job) {
|
||||
private boolean tryAssegnment(final WfJournalEntry job, final String executorId) {
|
||||
|
||||
final String id = job.getProcessId();
|
||||
wfJournalEntryRepository.tryAssegnment(id, executorId);
|
||||
|
||||
|
|
Loading…
Reference in New Issue