Skip to content

Commit

Permalink
feat: make Run task metadata settable (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
chamini2 authored Sep 26, 2024
1 parent 4714c29 commit f09e4a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/isolate/backends/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def forward_lines(fd: int) -> None:
return # Nothing to read

for line in raw_data.splitlines():
# TODO: parse the lines to include `extra={...}` added by the logger?
hook(line)

def _reader():
Expand Down
8 changes: 7 additions & 1 deletion src/isolate/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,19 @@ def Run(
context: ServicerContext,
) -> Iterator[definitions.PartialRunResult]:
try:
yield from self._run_task(RunTask(request=request))
# HACK: we can support only one task at a time for Run
# TODO: move away from this when we use submit for env-aware tasks
task = RunTask(request=request)
self.background_tasks["RUN"] = task
yield from self._run_task(task)
except GRPCException as exc:
return self.abort_with_msg(
exc.message,
context,
code=exc.code,
)
finally:
self.background_tasks.pop("RUN", None)

def List(
self,
Expand Down

0 comments on commit f09e4a1

Please sign in to comment.