feat(core): Add commands to workers to respond with current state (#7029)
This PR adds new endpoints to the REST API: `/orchestration/worker/status` and `/orchestration/worker/id` Currently these just trigger the return of status / ids from the workers via the redis back channel, this still needs to be handled and passed through to the frontend. It also adds the eventbus to each worker, and triggers a reload of those eventbus instances when the configuration changes on the main instances.
This commit is contained in:
committed by
GitHub
parent
0a35025e5e
commit
7b49cf2a2c
35
packages/cli/src/controllers/orchestration.controller.ts
Normal file
35
packages/cli/src/controllers/orchestration.controller.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import config from '@/config';
|
||||
import { Authorized, Get, RestController } from '@/decorators';
|
||||
import { OrchestrationRequest } from '@/requests';
|
||||
import { Service } from 'typedi';
|
||||
import { OrchestrationService } from '../services/orchestration.service';
|
||||
|
||||
@Authorized(['global', 'owner'])
|
||||
@RestController('/orchestration')
|
||||
@Service()
|
||||
export class OrchestrationController {
|
||||
private config = config;
|
||||
|
||||
constructor(private readonly orchestrationService: OrchestrationService) {}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user