Refactor experiment status traceability - #2980
Conversation
PROBLEMS/OBSERVATIONS:1.
|
|
Which should be the possible states for an experiment?
Should we track when:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2980 +/- ##
==========================================
+ Coverage 77.75% 77.98% +0.23%
==========================================
Files 91 91
Lines 20185 20327 +142
Branches 3879 3889 +10
==========================================
+ Hits 15694 15852 +158
+ Misses 3548 3531 -17
- Partials 943 944 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@LuiggiTenorioK I've a few questions about how to handle the statuses in the I'm thinking about future maintainability of the databases (both |
|
I can answer on the deleted part, @ntorqulu . Not sure about the part of showing the experiment, but we want to keep the register of a deleted experiment so we know it was deleted, and so that we cannot re-use the expid. Keeping deleted entries in a DB is sometimes called a tombstone entry -- https://en.wikipedia.org/wiki/Tombstone_(data_store). We can purge deleted entries after some time if needed, but it could be useful for traceability. At the moment, the main problem we have with the deleted experiments is this one: #1072 |
|
Great, thanks for the explanation @kinow! It makes sense to delete them in batch once the current_time - modified_time is greater than a specified threshold if necessary. About the issue with the deleted experiments, yes, I've been facing the same problem. If you:
For now, I'll enforce uniqueness in expid column and do not delete experiment rows in neither table. The only thing that will be updated is the status of the experiment to DELETED. For the old ones, I'll keep the newest row with the same expid. |
|
@ntorqulu is just as Bruno mentioned above. A logical delete is almost always a must if we want to keep traceability, especially if we don't want to reuse expids. In the GUI, it is also nice to know if the experiment has been deleted to keep the user informed (probably with a message like Also, take into account that Autosubmit is not the only one that modifies the |
|
Yes, I've this in mind! I was just checking first the backend because it's what I'm currently more familiar. How do you want to handle the API modifications @LuiggiTenorioK? I open an issue for you to handle it or I assign it to myself to continue the refactor in the API? |
Filtering by status seems like a good idea. I'll probably include the
First, I think it's better if we have an issue to discuss the modifications to be made in the API. I'll create it and tag you to continue the thread there. |
|
Okay! I'll take a look @LuiggiTenorioK . Thanks!
|
To keep data consistent, we should
It is not incorrect to have it like that.
Then, "paused" and "completed" (or better said, "stopped" (because there is no pause command, just stop or kill the process) and "finished" (because there might be pending tasks to do, like restart failed jobs)) with an additional "created" state could be valid states to split the |
|
+1 to what @LuiggiTenorioK said. I think @ntorqulu 's state diagram comes from the code. I don't think the |
|
Yes, the current state diagram is from the code, I'll update it with @LuiggiTenorioK's suggestions before changing anything in the code. This way we can have it as reference.
|
3d83a3e to
9f6b42f
Compare
|
QUESTION: What to do with old experiments and its |
|
|
From what I'm understanding, |
|
Also is it usefull to have the timestamp when the experiment was created? |
Ok, it makes sense like that. This heartbeat will serve to determine if the experiment stopped abruptly and didn't achieve the change in status to
That timestamp should also be available in the
Yes, this is another issue, because we currently use the creation time of the dir as the experiment creation, and we don't want to rely on the file system. More likely, we can have it as another column in the |
Yes, this way we can filter even more the experiments the API can modify. For now I'll leave
I've been debugging where The problem is that only when there are job changes the
Is it ok to leave it for another pr? Or better implement it in this one too? |
It seems unrelated to this PR. I would leave it for another one. |
Okay! I'll open a new issue to not forget this. |
The
Same as the
Agree +1
Currently, neither table is essential for running an experiment. So, probably it is ok to keep it like that because it is worse if the user cannot run the experiment than having that traceability.
I saw that happening before, and it is annoying. For me, it shouldn't do that. However, I am not 100% sure if removing that process can affect other things; maybe @kinow knows better. |
Okay thanks! I was not thinking about this. I see that install is not applying
Mmm okay. I was thinking that when user executes
But I don't know if it's in the scope of this pr. It's an edge case when the exp has config files but is not registered into autosubmit.db. |
Yes, I think it goes a little bit outside the scope. It is an edge case of another issue. In this PR, it is better to assume there is a correct common setup. Also, the creation of the tables and permissions can be handled in a different PR. There is also an existing separated issue related to that: #2641 |
…ng adapted with as_db
d1c86a0 to
8132d3d
Compare
| | ``autosubmit.db`` | ``$HOME/autosubmit/autosubmit.db`` | The main database of Autosubmit. The location can be customized in the ``autosubmitrc`` file. | | ||
| +-------------------+------------------------------------+----------------------------------------------------------------------------------------------------------+ | ||
| | ``as_times.db`` | ``$HOME/autosubmit/as_times.db`` | Deprecated API. Used by Autosubmit API with Autosubmit ``3.x``. Kept for backward compatibility for now. | | ||
| | ``as_times.db`` | ``$HOME/autosubmit/as_times.db`` | The secondary database of Autosubmit. Used to keep track of the experiment status. | |
There was a problem hiding this comment.
Databases section of the documentation should be updated. Currently only changed the part related to the as_times.db to avoid making this pr bigger.
But the rst is also referencing some status.db and a test folder I don't find anywhere.
There was a problem hiding this comment.
autosubmit/metadata/test/status.db used to exist to measure the IO latency of /esarchive at BSC. This was one of the first things I removed from the old API since we wanted Autosubmit to be a generalized tool rather than one made for BSC.



Closes #2049, #2137
Things done
experiment_statustable. Possible experiment status are:NOT_RUNNING,RUNNING,ARCHIVEDandDELETED.expidandcreate) are marked asNOT_RUNNING. Implementation left open if we want to add more states in the future.autosubmit.dbandas_times.db. Once the experiment is deleted, it's kept in the database with statusDELETED(tombstone).last_heartbeatto tableexperiment_status. Each experiment creates a daemon thread (autosubmit-heartbeat-{expid}) that updates thelast_heartbeattimestamp every 2 min while the experiment is running.nameinexperiment_statustable, kept most recent one.Check List
CONTRIBUTING.md.pyproject.toml.CHANGELOG.mdif this is a change that can affect users.Closes #1234).