#945: Fix portalocker error handling.
This change modifies how Autosubmit reacts to exceptions raised in commands like `autosubmit run` or `autosubmit create`. Previously, Autosubmit would capture exceptions raised during the execution of these commands it in a central function, however, in this function it would log the error and then release the portalocker lock. This caused the issue (reported ~2 years ago?) that running these commands three times caused errors. On the first run the lock was created. On the second command run the command would be prevented from running by portalocker and the error logged but the lock was also deleted. And then on the third run there was no lock, so it would cause the issue reported. Now, the code will never release the lock, until the context-manager created finalizes, or someone/something deletes the lock file. Errors are still captured and logged, but if the error/exception raised is a portalocker exception, we log but without releasing the lock (it is like letting a prisoner go if we realize it is in jail, and then complaining that it was set free :)
Please register or sign in to comment