Skip to content

Commit

Permalink
bad wip
Browse files Browse the repository at this point in the history
Signed-off-by: technillogue <technillogue@gmail.com>
  • Loading branch information
technillogue committed Nov 28, 2023
1 parent 40a9f48 commit 34d05af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions python/cog/server/eventtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#
@define
class PredictionInput:
id: str
payload: Dict[str, Any]


Expand All @@ -25,16 +26,19 @@ class Log:

@define
class PredictionOutput:
id: str
payload: Any


@define
class PredictionOutputType:
id: str
multi: bool = False


@define
class Done:
id: str
canceled: bool = False
error: bool = False
error_detail: str = ""
Expand Down
4 changes: 2 additions & 2 deletions python/cog/server/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def setup(self) -> Iterable[_PublicEventType]:
return self._wait(raise_on_error="Predictor errored during setup")

def predict(
self, payload: Dict[str, Any], poll: Optional[float] = None
self, id: str, payload: Dict[str, Any], poll: Optional[float] = None
) -> None: #Iterator[_PublicEventType]:
self._assert_state(WorkerState.READY)
self._state = WorkerState.PROCESSING
self._allow_cancel = True
self._events.send(PredictionInput(payload=payload))
self._events.send(PredictionInput(id=id, payload=payload))

# return self._wait(poll=poll)

Expand Down

0 comments on commit 34d05af

Please sign in to comment.