-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add data migration for old calculation jobs #2854
Comments
@giovannipizzi Seb is happy to implement the migration once we've agreed on a mapping from old to new states. Something like
We're waiting until we have some input from you here. @sphuber On a side note, having one place to look for the state of a job seems, on the surface, preferable to having multiple states spread across different classes (with one of them temporary/conditional, if I understand correctly). Could you maybe explain in a few words the reasoning behind this current implementation? |
I initially did not want to put it in, because I think the new process state should be sufficient. However, the change did introduce a loss of granularity. For example for all the stages of the Just in case there might be a use case of people wanting to query for |
Just a naive question: Is it necessary to have this split between |
Yes, I think it's necessary (at least to not change the behaviour of the process state just for the calcjob) because |
I would support to map The conventional in PS: Sorry I clicked the wrong button and closed the issue... |
Thanks for your input @zhubonan . I agree, the As far as the further use of the |
I would suggest to just let Regarding the |
@zhubonan I think I agree with your suggestion regarding the specific old failed states. I have adapted the table. The only two that are missing now are the Then for |
I had this impression that 0-99 should not be used for plugins as they are supposed to be reserved. Maybe it was mentioned in the migration workshop or somewhere in the documentation. I have not worked with any By the way, for those nodes in NEW/TOSUBMIT/SUBMITTING/PARSING etc state, there is obviously a problem with them as the plugins in 0.12.x and 1.0.x are unlikely to be compatible and it may cause problem to migrate the database in that state. Perhaps it makes sense to warn the user, and if they choose to proceed, set the process state of those nodes to |
The About the old active states, good point. We have to think what to do here, just setting excepted might not be ok. Imagine someone was actually running some calculations and then stopped the daemon. Then he migrates. This is a perfectly legal and possible scenario. There is no way to correctly migrate this, no matter what we do. However, there is a bigger problem. Even if we could migrate them properly, they won't be able to continue, because the system that they were based on, has been completely removed in |
I usually side with the user on such issues but here I have to say: with all the changes in 1.0, expecting that you can stop your daemon, migrate to 1.0 and just continue your calculation (plugins changed etc etc. ) would be a bit ... insane ;-) |
I would agree, but users might not necessarily realize this limitation. As far as I know we never communicated this explicitly, nor are there any warnings or safe guards in the code. I am wondering what the best way would be too accomplish this, but I am coming up short so far... |
The first thing I can think of would be to print some CAPITALIZED warnings before migration. The current version already has a good one to remind the user backing up the database. Perhaps it can give extra warnings when the migration is detected to be from 0.12.x to 1.0.0? It is probably not possible to detect the state of the 0.12 database in 1.0.0. The other way I can think of would be to make a program in 0.12 to check the database and only allow migration from the database that passes (but overridable). This can perhaps can be included in a minor release of 0.12. |
This will be taken care of on the |
JobCalculation
nodes in old databases will currently automatically be migrated toCalcJobNode
instances. However, these nodes still have some old attributes that are not migrated and miss many attributes that they would have had, had they been run withaiida-core==1.0.0
, e.g. the process state and process label attributes.We should consider adding a data migration that tries as best we can to transform these old calculations into something compatible.
DbCalcJobState
was dropped, but the proxy attributestate
remains there. TheCalcJobNode.get_state
method will try to cast this into the newCalcJobState
enum, but the old calculations can contain values that are not supported by this enum, causing aValueError
to be thrown. In the new system, thisstate
attribute is a temporary sub-state, in addition to the process state, that only applies toCalcJob
processes, while they are active and are deleted once the process terminates. Therefore, I propose we simply delete this state for allCalcJobNode
s that are in a terminal state. We should be careful that we only apply this to terminated process nodes, because there might be active ones during the migration that we do not want to touch.CalcJobNodes
should have aprocess_state
,process_label
and optionally anexit_status
. Theprocess_label
is currently set as the name of the process class or function name (in the case of a process function). I am not sure if an equivalent was stored on the old node, but otherwise we could maybe use the value in theprocess_type
, which should have been added during existing migrations. The problem here will be how to set theprocess_state
. The old calculations only had thestate
attribute, the old job calc state, but those values do not map one-to-one on the new process states. For example, any of the old "failed" states, such asSUBMISSIONFAILED
, orFAILED
: should they becomeExcepted
orFinished
with a non-zero exit status. But in the case of the latter, what exit status should be used?This can be summed up in the following table which should tell how to translate the
state
attribute to the correctprocess_state
andexit_status
:NEW
Killed
None
Legacy JobCalculation with state 'NEW'
TOSUBMIT
Killed
None
Legacy JobCalculation with state 'TOSUBMIT'
SUBMITTING
Killed
None
Legacy JobCalculation with state 'SUBMITTING'
WITHSCHEDULER
Killed
None
Legacy JobCalculation with state 'WITHSCHEDULER'
COMPUTED
Killed
None
Legacy JobCalculation with state 'COMPUTED'
RETRIEVING
Killed
None
Legacy JobCalculation with state 'RETRIEVING'
PARSING
Killed
None
Legacy JobCalculation with state 'PARSING'
FINISHED
Finished
SUBMISSIONFAILED
Excepted
None
Legacy JobCalculation with state 'SUBMISSIONFAILED'
RETRIEVALFAILED
Excepted
None
Legacy JobCalculation with state 'RETRIEVALFAILED'
PARSINGFAILED
Excepted
None
Legacy JobCalculation with state 'PARSINGFAILED'
FAILED
Finished
IMPORTED
Notes;
IMPORTED
state was never actually stored in thestate
attribute, so we do not have to consider it in the migration.Killed
. Before the migration is performed, the user will be warned (note this still needs to be added) to first finish all running calculations and workflows. Then stop the daemon and perform the migration. In a sense then, if we find these "active" calculation states during the migration, it means the user either has ignored the warning and is effectively telling us to kill them or the calculation got stuck in an active state and was lost, in which case theKilled
state is also appropriate.process_label
, inferring the original class name is difficult, although theprocess_type
could potentially be used. However, since this complicated to do in SQL we simply putLegacy JobCalculation
.The text was updated successfully, but these errors were encountered: