1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

feat(operations): jobs a request runs

Request jobs (an upload's chunks) run in gunicorn: their kind is admitted
running with the request as its worker, never claimed or recovered by the
worker, cancelled in the request, and asked by every housekeeping pass to
end its jobs that went idle. The panel can follow a job the page just
started. A job a request runs does not wait for the worker, so it does not
raise the worker-unavailable warning on the Jobs page or in the panel.
This commit is contained in:
catborise 2026-10-16 08:52:34 +03:00
parent 41e1fcd4b9
commit f2138e54d8
14 changed files with 224 additions and 17 deletions

View file

@ -10,12 +10,13 @@ class OperationSerializer(serializers.ModelSerializer):
label = serializers.SerializerMethodField()
resource_label = serializers.SerializerMethodField()
cancellable = serializers.SerializerMethodField()
in_request = serializers.SerializerMethodField()
class Meta:
model = Operation
fields = ["id", "kind", "label", "username", "resource", "resource_label", "state", "phase",
"progress_done", "progress_total", "result", "error", "created_at", "started_at",
"finished_at", "cancel_requested", "cancellable", "resolution", "resolution_note"]
"finished_at", "cancel_requested", "cancellable", "in_request", "resolution", "resolution_note"]
read_only_fields = fields
def get_label(self, op) -> str:
@ -28,6 +29,10 @@ class OperationSerializer(serializers.ModelSerializer):
kind = KINDS.get(op.kind)
return op.state == Operation.QUEUED or bool(kind and kind.cancellable and op.state == Operation.RUNNING)
def get_in_request(self, op) -> bool:
"""A request runs it: it does not wait for the worker."""
return op.in_request
class OperationSummarySerializer(serializers.Serializer):
kind = serializers.CharField()