Skip to content

Commit

Permalink
more fixes after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Achille Roussel <[email protected]>
  • Loading branch information
achille-roussel committed Jun 14, 2024
1 parent b894337 commit b4e2db4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 154 deletions.
12 changes: 1 addition & 11 deletions src/dispatch/proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,7 @@ def __init__(self, req: function_pb.RunRequest):

self._has_input = req.HasField("input")
if self._has_input:
if req.input.Is(google.protobuf.wrappers_pb2.BytesValue.DESCRIPTOR):
input_pb = google.protobuf.wrappers_pb2.BytesValue()
req.input.Unpack(input_pb)
input_bytes = input_pb.value
try:
self._input = pickle.loads(input_bytes)
except Exception:
self._input = input_bytes
else:
self._input = _pb_any_unpack(req.input)

self._input = _pb_any_unpack(req.input)
else:
if req.poll_result.coroutine_state:
raise IncompatibleStateError # coroutine_state is deprecated
Expand Down
1 change: 1 addition & 0 deletions src/dispatch/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def make_request(call: Call) -> RunRequest:
root_dispatch_id=root_dispatch_id,
poll_result=PollResult(
coroutine_state=res.poll.coroutine_state,
typed_coroutine_state=res.poll.typed_coroutine_state,
results=results,
),
)
Expand Down
20 changes: 1 addition & 19 deletions tests/dispatch/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ async def resume(
poll = assert_poll(prev_output)
input = Input.from_poll_results(
main.__qualname__,
poll.coroutine_state,
any_unpickle(poll.typed_coroutine_state),
call_results,
Error.from_exception(poll_error) if poll_error else None,
)
Expand Down Expand Up @@ -492,30 +492,12 @@ def assert_exit_result_value(output: Output, expect: Any):
assert expect == any_unpickle(result.output)


<<<<<<< HEAD
def resume(
self,
main: Callable,
prev_output: Output,
call_results: List[CallResult],
poll_error: Optional[Exception] = None,
):
poll = self.assert_poll(prev_output)
input = Input.from_poll_results(
main.__qualname__,
any_unpickle(poll.typed_coroutine_state),
call_results,
Error.from_exception(poll_error) if poll_error else None,
)
return self.runner.run(OneShotScheduler(main).run(input))
=======
def assert_exit_result_error(
output: Output, expect: Type[Exception], message: Optional[str] = None
):
result = assert_exit_result(output)
assert not result.HasField("output")
assert result.HasField("error")
>>>>>>> 626d02d (aiohttp: refactor internals to use asyncio throughout the SDK)

error = Error._from_proto(result.error).to_exception()
assert error.__class__ == expect
Expand Down
124 changes: 0 additions & 124 deletions tests/test_aiohttp.py

This file was deleted.

0 comments on commit b4e2db4

Please sign in to comment.