Open
Description
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):
-
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
). -
If the previous succeeded, proceed to compile the namespace, then remove the lockfile. Done.
-
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.