Skip to content

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

Open
@pavel-kirienko

Description

@pavel-kirienko

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions