1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing solo job running

This commit is contained in:
Patrik J. Braun 2024-01-03 11:34:00 +01:00
parent dccd9c30e1
commit 4a2959edaf
3 changed files with 17 additions and 8 deletions

View File

@ -3,6 +3,7 @@ import {ErrorCodes, ErrorDTO} from '../../../common/entities/Error';
import {ObjectManagers} from '../../model/ObjectManagers';
import {StatisticDTO} from '../../../common/entities/settings/StatisticDTO';
import {MessengerRepository} from '../../model/messenger/MessengerRepository';
import {JobStartDTO} from '../../../common/entities/job/JobDTO';
export class AdminMWs {
public static async loadStatistic(
@ -81,9 +82,10 @@ export class AdminMWs {
): Promise<void> {
try {
const id = req.params['id'];
const JobConfig: Record<string, unknown> = req.body.config;
const soloRun: boolean = req.body.soloRun;
const allowParallelRun: boolean = req.body.allowParallelRun;
const jobStart: JobStartDTO = req.body;
const JobConfig: Record<string, unknown> = jobStart.config;
const soloRun: boolean = jobStart.soloRun;
const allowParallelRun: boolean = jobStart.allowParallelRun;
await ObjectManagers.getInstance().JobManager.run(
id,
JobConfig,

View File

@ -26,6 +26,13 @@ export interface JobDTO {
ConfigTemplate: DynamicConfig[];
}
export interface JobStartDTO {
soloRun: boolean;
config?: Record<string, unknown>;
allowParallelRun: boolean;
}
export const JobDTOUtils = {
getHashName: (jobName: string, config: any = {}) => {
const sorted = Object.keys(config).sort().reduce((ret, key) => `${ret},${key}:${JSON.stringify(config[key])}`, '');

View File

@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs';
import {JobProgressDTO, JobProgressStates, OnTimerJobProgressDTO,} from '../../../../common/entities/job/JobProgressDTO';
import {NetworkService} from '../../model/network/network.service';
import {JobScheduleDTO} from '../../../../common/entities/job/JobScheduleDTO';
import {JobDTO, JobDTOUtils} from '../../../../common/entities/job/JobDTO';
import {JobDTO, JobDTOUtils, JobStartDTO} from '../../../../common/entities/job/JobDTO';
import {BackendtextService} from '../../model/backendtext.service';
import {NotificationService} from '../../model/notification.service';
import {DynamicConfig} from '../../../../common/entities/DynamicConfig';
@ -85,8 +85,8 @@ export class ScheduledJobsService {
public async start(
jobName: string,
config?: any,
soloStart = false,
config?: Record<string, unknown>,
soloRun = false,
allowParallelRun = false
): Promise<void> {
try {
@ -96,8 +96,8 @@ export class ScheduledJobsService {
{
config,
allowParallelRun,
soloStart,
}
soloRun,
} as JobStartDTO
);
// placeholder to force showing running job
this.addDummyProgress(jobName, config);