From 8d7ef2b8be7d7eaf4a4974830a6054d2ebd86f13 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Wed, 16 Oct 2024 14:18:05 +1100 Subject: [PATCH] fix: edit the job context and batch doc comments (#148) --- nitric/context.py | 12 ++++++------ nitric/resources/job.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nitric/context.py b/nitric/context.py index b7ba59a..127d50f 100644 --- a/nitric/context.py +++ b/nitric/context.py @@ -369,7 +369,7 @@ async def chained_middleware(ctx: C, nxt: Optional[Middleware[C]] = None) -> C: class JobRequest: - """Represents a translated Job, from a Job Definition, forwarded from the Nitric Runtime Server.""" + """Represents a job task forwarded from the Nitric Runtime Server.""" data: dict[str, Any] @@ -379,7 +379,7 @@ def __init__(self, data: dict[str, Any]): class JobResponse: - """Represents the response to a trigger from a Job submission as a result of a SubmitJob call.""" + """Represents the response to a job task, indicating the result.""" def __init__(self, success: bool = True): """Construct a new EventResponse.""" @@ -387,20 +387,20 @@ def __init__(self, success: bool = True): class JobContext: - """Represents the full request/response context for an Event based trigger.""" + """Represents the full request/response context for a Job task trigger.""" def __init__(self, request: JobRequest, response: Optional[JobResponse] = None): - """Construct a new EventContext.""" + """Construct a new JobContext.""" self.req = request self.res = response if response else JobResponse() @staticmethod def _from_request(msg: BatchServerMessage) -> "JobContext": - """Construct a new EventContext from a Topic trigger from the Nitric Membrane.""" + """Construct a new JobContext from a Job trigger from the Nitric Server.""" return JobContext(request=JobRequest(data=dict_from_struct(msg.job_request.data.struct))) def to_response(self) -> BatchClientMessage: - """Construct a EventContext for the Nitric Membrane from this context object.""" + """Construct a JobContext for the Nitric Server from this context object.""" return BatchClientMessage(job_response=BatchJobResponse(success=self.res.success)) diff --git a/nitric/resources/job.py b/nitric/resources/job.py index ccaedf8..8112e6b 100644 --- a/nitric/resources/job.py +++ b/nitric/resources/job.py @@ -50,7 +50,7 @@ def __init__( memory: int | None = None, gpus: int | None = None, ): - """Construct a new WebsocketHandler.""" + """Construct a new JobHandler.""" self._handler = handler self._responses = AsyncNotifierList() self._registration_request = RegistrationRequest( @@ -70,7 +70,7 @@ async def _message_request_iterator(self): yield response async def start(self) -> None: - """Register this subscriber and listen for messages.""" + """Register this job handler and listen for tasks.""" channel = ChannelManager.get_channel() server = JobStub(channel=channel)