Skip to content

Adding debug for containers in IDEs#1106

Draft
AlexandreDoneux wants to merge 7 commits intoINGInious:mainfrom
AlexandreDoneux:remote_container_debugging
Draft

Adding debug for containers in IDEs#1106
AlexandreDoneux wants to merge 7 commits intoINGInious:mainfrom
AlexandreDoneux:remote_container_debugging

Conversation

@AlexandreDoneux
Copy link
Copy Markdown
Contributor

@AlexandreDoneux AlexandreDoneux commented Apr 8, 2026

This PR aims to add the possibility of interactive debug inside the containers running jobs.

Steps :

  • Pycharm debug for the INGInious script and the scripts inside inginious_container_api (using the pydevd_pycharm python package)
  • Broader usage for all IDEs using the Debug Adapter Protocol (DAP)

Do you think debug capabilities for the run files is an interesting addition ?

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 8, 2026

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Complexity 1 medium

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@AlexandreDoneux AlexandreDoneux force-pushed the remote_container_debugging branch from bc14a1d to a953b4a Compare April 8, 2026 13:23
Copy link
Copy Markdown
Member

@anthonygego anthonygego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should enable this only on demand/when needed. Either passing an environment variable from PyCharm and frowarding it from the agent to the container, or rely on the existing debug flag.

If this fails silently if the server is not listening, this could be OK, but I guess in this case it would triy and time out. This is not a wanted behaviour as this would severly impact the execution time

A nice addition (not for this PR) would be to allow the user to specify the hostname and port of the debug server and keep those as default. If the docker stack is located on another host, the host-gateway IP won't match the debug server one. Besides, the hardcoded port may not be available on the developer host if it is already used by another service.

Comment thread inginious/agent/docker_agent/_docker_interface.py Outdated
Comment thread base-containers/base/bin/INGInious Outdated
@AlexandreDoneux AlexandreDoneux changed the title Adding remote debug for containers in IDEs Adding debug for containers in IDEs Apr 10, 2026
@AlexandreDoneux
Copy link
Copy Markdown
Contributor Author

The existing debug_mode is defined for each job separately and is given by the BackendNewJob message to the docker agent. So it is best to use a new environment variable to indicate if debug through the IDE is wanted. Any suggestions for a good variable name so it isn't confused for a parameter for the remote ssh debug ?

For a future PR for remote debugging :
As suggested we might want to use debug_host and debug_ports to specify the remote agent used and allow debug on the containers on that agent. However it is indicated that those configuration parameters are only to be used is the backend is on local. Does that mean we currently can't do remote ssh debugging if the backend is on a remote machine ?

# Only for backend: local
local-config:
    # debug_host: localhost  # host that will be indicated to users when they want to use the task remote debug feature. Automatically guessed by
                             # default
    debug_ports: 64000-64100 #port range use for remote debug feature

@anthonygego
Copy link
Copy Markdown
Member

Any suggestions for a good variable name so it isn't confused for a parameter for the remote ssh debug ?

ide_debug or simply debugger

Actually it might be more productive to directly add the options in the webapp config file and the docker agent CLI arguments.

Does that mean we currently can't do remote ssh debugging if the backend is on a remote machine ?

If the docker agent is used on another host, the args are passed in the CLI. This local-config feature is used for small deployments and development.

In conclusion, debugger_host and debugger_port seems two good new options to add to local-config and docker agent CLI.

@AlexandreDoneux
Copy link
Copy Markdown
Contributor Author

A message is now added to stderr if the debug server is not available. It does not fail the job anymore.

I have also fixed the time limit for a job to half an hour if the container debugging is enabled. Without it the job just stops after the set limit and debugging is not possible. Should I add that fixed limit as a config parameter ?

Comment thread inginious/agent/docker_agent/__init__.py Outdated
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

Successfully merging this pull request may close these issues.

2 participants