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:
parent
dccd9c30e1
commit
4a2959edaf
@ -3,6 +3,7 @@ import {ErrorCodes, ErrorDTO} from '../../../common/entities/Error';
|
|||||||
import {ObjectManagers} from '../../model/ObjectManagers';
|
import {ObjectManagers} from '../../model/ObjectManagers';
|
||||||
import {StatisticDTO} from '../../../common/entities/settings/StatisticDTO';
|
import {StatisticDTO} from '../../../common/entities/settings/StatisticDTO';
|
||||||
import {MessengerRepository} from '../../model/messenger/MessengerRepository';
|
import {MessengerRepository} from '../../model/messenger/MessengerRepository';
|
||||||
|
import {JobStartDTO} from '../../../common/entities/job/JobDTO';
|
||||||
|
|
||||||
export class AdminMWs {
|
export class AdminMWs {
|
||||||
public static async loadStatistic(
|
public static async loadStatistic(
|
||||||
@ -81,9 +82,10 @@ export class AdminMWs {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const id = req.params['id'];
|
const id = req.params['id'];
|
||||||
const JobConfig: Record<string, unknown> = req.body.config;
|
const jobStart: JobStartDTO = req.body;
|
||||||
const soloRun: boolean = req.body.soloRun;
|
const JobConfig: Record<string, unknown> = jobStart.config;
|
||||||
const allowParallelRun: boolean = req.body.allowParallelRun;
|
const soloRun: boolean = jobStart.soloRun;
|
||||||
|
const allowParallelRun: boolean = jobStart.allowParallelRun;
|
||||||
await ObjectManagers.getInstance().JobManager.run(
|
await ObjectManagers.getInstance().JobManager.run(
|
||||||
id,
|
id,
|
||||||
JobConfig,
|
JobConfig,
|
||||||
|
@ -26,6 +26,13 @@ export interface JobDTO {
|
|||||||
ConfigTemplate: DynamicConfig[];
|
ConfigTemplate: DynamicConfig[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface JobStartDTO {
|
||||||
|
soloRun: boolean;
|
||||||
|
config?: Record<string, unknown>;
|
||||||
|
allowParallelRun: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export const JobDTOUtils = {
|
export const JobDTOUtils = {
|
||||||
getHashName: (jobName: string, config: any = {}) => {
|
getHashName: (jobName: string, config: any = {}) => {
|
||||||
const sorted = Object.keys(config).sort().reduce((ret, key) => `${ret},${key}:${JSON.stringify(config[key])}`, '');
|
const sorted = Object.keys(config).sort().reduce((ret, key) => `${ret},${key}:${JSON.stringify(config[key])}`, '');
|
||||||
|
@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs';
|
|||||||
import {JobProgressDTO, JobProgressStates, OnTimerJobProgressDTO,} from '../../../../common/entities/job/JobProgressDTO';
|
import {JobProgressDTO, JobProgressStates, OnTimerJobProgressDTO,} from '../../../../common/entities/job/JobProgressDTO';
|
||||||
import {NetworkService} from '../../model/network/network.service';
|
import {NetworkService} from '../../model/network/network.service';
|
||||||
import {JobScheduleDTO} from '../../../../common/entities/job/JobScheduleDTO';
|
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 {BackendtextService} from '../../model/backendtext.service';
|
||||||
import {NotificationService} from '../../model/notification.service';
|
import {NotificationService} from '../../model/notification.service';
|
||||||
import {DynamicConfig} from '../../../../common/entities/DynamicConfig';
|
import {DynamicConfig} from '../../../../common/entities/DynamicConfig';
|
||||||
@ -85,8 +85,8 @@ export class ScheduledJobsService {
|
|||||||
|
|
||||||
public async start(
|
public async start(
|
||||||
jobName: string,
|
jobName: string,
|
||||||
config?: any,
|
config?: Record<string, unknown>,
|
||||||
soloStart = false,
|
soloRun = false,
|
||||||
allowParallelRun = false
|
allowParallelRun = false
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@ -96,8 +96,8 @@ export class ScheduledJobsService {
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
allowParallelRun,
|
allowParallelRun,
|
||||||
soloStart,
|
soloRun,
|
||||||
}
|
} as JobStartDTO
|
||||||
);
|
);
|
||||||
// placeholder to force showing running job
|
// placeholder to force showing running job
|
||||||
this.addDummyProgress(jobName, config);
|
this.addDummyProgress(jobName, config);
|
||||||
|
Loading…
Reference in New Issue
Block a user