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

PyCharm - Cloud Run Locally not working with gunicorn #3177

Open
yan-hic opened this issue Dec 28, 2023 · 2 comments
Open

PyCharm - Cloud Run Locally not working with gunicorn #3177

yan-hic opened this issue Dec 28, 2023 · 2 comments

Comments

@yan-hic
Copy link

yan-hic commented Dec 28, 2023

When using PyCharm to debug, requirements.txt has unknown dependency on debugpy - and requests is not used either.
Likewise, Procfile starts VS Studio debugger - not used with IntelliJ

On the latter, instead of Procfile, why not stay consistent with https://cloud.google.com/run/docs/tips/python#optimize_gunicorn and use a WSGI in Dockerfile CMD since the goal is to deploy to CR eventually.
Problem: debugging does not work with gunicorn with Failed to start Cloud Run dev session

For debugging locally, one needs to switch from

CMD gunicorn --preload --bind :8080 --workers 2 --threads 8 --timeout 0 app:app
to
ENTRYPOINT ["python", "app.py"]
Not ideal for change control.

  • IDE type (e.g. IntelliJ, Pycharm): PyCharm
  • IDE version: 2023.3.2 Pro
  • Cloud Code version (Settings > Plugins > Cloud Code): 23.11.3
  • Cloud SDK (Settings > Cloud Code > Cloud SDK)
    • Are you allowing the plugin to manage the Cloud SDK: yes
    • Version of the Cloud SDK: 458.0.1
  • Skaffold version (If you are using Kubernetes features; Settings > Cloud Code > Kubernetes): 2.7.1
  • Operating System: win11
@yan-hic yan-hic changed the title PyCharm - Sample Flask Cloud Run incorrect/unnecessary settings PyCharm - Cloud Run Locally not working with gunicorn Dec 29, 2023
@ivanporty
Copy link
Contributor

Thanks for the report @yan-hic!
@briandealwis Do we have any suggestions here Brian?

@briandealwis
Copy link
Member

briandealwis commented Jan 8, 2024

@yan-hic you seen seem to be referencing an example? I'm not sure where this Procfile comes from? Including your logs would be helpful: there are a number of layers involved in enabling debugging (particularly for Python) both on the host PC and the remote cluster, and errors or warnings are emitted during the processing.

Debugging works with gunicorn, and it is used in several of the examples on the skaffold debug page. We don't support unwrapping exec -- trying to parse shell script seemed a recipe for disaster -- though perhaps exec could be worth supporting (I think the relevant code would be here).

Debugging automatically picks up the debugpy through special support images that are made available at run time: the user doesn't need to add debugpy to their requirements.txt. There's some documentation on the skaffold debug doc page.

cc: @renzodavid9 and @ericzzzzzzz from the Skaffold team

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

No branches or pull requests

3 participants