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

Automatic DSDL compilation should lock the directory when compilation is in progress #335

Open
pavel-kirienko opened this issue Apr 21, 2024 · 0 comments

Comments

@pavel-kirienko
Copy link
Member

pavel-kirienko commented Apr 21, 2024

This is to properly support the common scenario when multiple scripts are launched concurrently and both attempt to compile the same namespace, which is a common occurrence with orchestration.

I propose roughly the following algorithm (may require refinement):

  1. Attempt to create a lockfile in the compilation output directory (usually ~/.pycyphal) named after the namespace we're attempting to compile (e.g., uavcan.lock).

  2. If the previous succeeded, proceed to compile the namespace, then remove the lockfile. Done.

  3. On failure to lock the namespace, sleep for a second and check if it's still there.

    • If the lock is gone, attempt importing the namespace again; on success, assume the namespace has been compiled by another process. On import error, assume the namespace requires recompilation and proceed to step 1.
    • If the lock is still there, continue waiting.

Suggestions welcome.

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

2 participants