2023-09-07 05:44:19 -07:00
|
|
|
import { Authorized, Get, RestController } from '@/decorators';
|
|
|
|
import { OrchestrationRequest } from '@/requests';
|
|
|
|
import { Service } from 'typedi';
|
2023-10-30 08:22:32 -07:00
|
|
|
import { SingleMainInstancePublisher } from '@/services/orchestration/main/SingleMainInstance.publisher';
|
2023-09-07 05:44:19 -07:00
|
|
|
|
|
|
|
@Authorized(['global', 'owner'])
|
|
|
|
@RestController('/orchestration')
|
|
|
|
@Service()
|
|
|
|
export class OrchestrationController {
|
2023-10-30 08:22:32 -07:00
|
|
|
constructor(private readonly orchestrationService: SingleMainInstancePublisher) {}
|
2023-09-07 05:44:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* These endpoint currently do not return anything, they just trigger the messsage to
|
|
|
|
* the workers to respond on Redis with their status.
|
|
|
|
* TODO: these responses need to be forwarded to and handled by the frontend
|
|
|
|
*/
|
|
|
|
@Get('/worker/status/:id')
|
|
|
|
async getWorkersStatus(req: OrchestrationRequest.Get) {
|
|
|
|
const id = req.params.id;
|
|
|
|
return this.orchestrationService.getWorkerStatus(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Get('/worker/status')
|
|
|
|
async getWorkersStatusAll() {
|
|
|
|
return this.orchestrationService.getWorkerStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Get('/worker/ids')
|
|
|
|
async getWorkerIdsAll() {
|
|
|
|
return this.orchestrationService.getWorkerIds();
|
|
|
|
}
|
|
|
|
}
|