def get(self, request_id): """ --- summary: Retrieve a specific Request parameters: - name: request_id in: path required: true description: The ID of the Request type: string responses: 200: description: Request with the given ID schema: $ref: '#/definitions/Request' 404: $ref: '#/definitions/404Error' 50x: $ref: '#/definitions/50xError' tags: - Requests """ self.logger.debug("Getting Request: %s", request_id) req = Request.objects.get(id=str(request_id)) req.children = Request.objects(parent=req) self.write(self.parser.serialize_request(req, to_string=False))
def initialize_counts(): for request in Request.objects(status__in=["CREATED", "IN_PROGRESS"]): label_args = { "system": request.system, "system_version": request.system_version, "instance_name": request.instance_name, } if request.status == "CREATED": queued_request_gauge.labels(**label_args).inc() elif request.status == "IN_PROGRESS": in_progress_request_gauge.labels(**label_args).inc()