Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal run with local entrypoint completes, but produces traceback #2620

Open
rmorgans opened this issue Dec 6, 2024 · 2 comments
Open

Modal run with local entrypoint completes, but produces traceback #2620

rmorgans opened this issue Dec 6, 2024 · 2 comments

Comments

@rmorgans
Copy link

rmorgans commented Dec 6, 2024

Running an app, using a local_entrypoint that uses a starmap to run remote functions (loading data)

inputs = [(sensor, installation, date) for date in sequential_dates]
    for events_loaded in load_by_installation_date.starmap(inputs):
        print(events_loaded)

The app appears to complete normally but does throw a traceback. Not sure what's going on, thought I would report.

❯ modal run load__detections.py 
✓ Initialized. View run at https://modal.com/apps/XXXX/ap-FVxCHuON0HxpTlLn1cBtBR
✓ Created objects.
├── 🔨 Created mount /Users/rick/Documents/SS/git_checkout/etl/xxx/load__xxx.py
└── 🔨 Created function load_by_installation_date.
1440
Stopping app - local entrypoint completed.
[Thread-1 (thread_inner)] 2024-12-06T21:08:19+1030 Loop attempt for _run_app.<locals>.heartbeat failed
Traceback (most recent call last):
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/_utils/async_utils.py", line 195, in loop_coro
    await asyncio.wait_for(async_f(), timeout=timeout)
  File "/Users/rick/.local/share/uv/python/cpython-3.11.10-macos-aarch64-none/lib/python3.11/asyncio/tasks.py", line 489, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/runner.py", line 56, in _heartbeat
    await retry_transient_errors(client.stub.AppHeartbeat, request, attempt_timeout=HEARTBEAT_TIMEOUT)
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/_utils/grpc_utils.py", line 184, in retry_transient_errors
    raise exc
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/_utils/grpc_utils.py", line 178, in retry_transient_errors
    return await fn(*args, metadata=metadata, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/client.py", line 396, in __call__
    return await self.client._call_unary(self._wrapped_method_name, req, timeout=timeout, metadata=metadata)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/client.py", line 338, in _call_unary
    return await self._call_safely(coro, grpclib_method.name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/modal/client.py", line 296, in _call_safely
    return await request_task
           ^^^^^^^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/grpclib/client.py", line 904, in __call__
    reply = await stream.recv_message()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/grpclib/client.py", line 425, in recv_message
    await self.recv_initial_metadata()
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/grpclib/client.py", line 393, in recv_initial_metadata
    self._raise_for_grpc_status(status, message, details)
  File "/Users/rick/.local/share/uv/tools/modal/lib/python3.11/site-packages/grpclib/client.py", line 345, in _raise_for_grpc_status
    raise GRPCError(status, message, details)
grpclib.exceptions.GRPCError: (<Status.FAILED_PRECONDITION: 9>, 'App state is APP_STATE_STOPPED', None)
✓ App completed. View run at https://modal.com/apps/xxx/xxx/ap-FVxCHuON0HxpTlLn1cBtBR

Here's my verson of modal

❯ modal --version
modal client version: 0.67.31

and running on a mac

@mwaskom
Copy link
Contributor

mwaskom commented Dec 17, 2024

AWAICT this isn't affecting the execution of your App, it's just an ugly traceback on cleanup?

@rmorgans
Copy link
Author

Yep - just took me a while to understand it was cleanup not app functionality - potentially disconcerting to new users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants