Skip to content

Add migration after the provenance redesign#2336

Merged
giovannipizzi merged 3 commits into
aiidateam:provenance_redesignfrom
sphuber:fix_2178_provenance_redesign_migration
Dec 11, 2018
Merged

Add migration after the provenance redesign#2336
giovannipizzi merged 3 commits into
aiidateam:provenance_redesignfrom
sphuber:fix_2178_provenance_redesign_migration

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented Dec 11, 2018

Fixes #2178

Tested on 5 production databases:

  • COFS (MaterialsCloud)
  • SSSP (MaterialsCloud)
  • 2D (MaterialsCloud)
  • 3DD (personal)
  • SDB (personal)

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 11, 2018

Coverage Status

Coverage decreased (-0.03%) to 68.931% when pulling 6924089 on sphuber:fix_2178_provenance_redesign_migration into 454bfc3 on aiidateam:provenance_redesign.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.002%) to 68.966% when pulling 5685025889cfb2fc15b0fc6b2d79bf6442ff3c18 on sphuber:fix_2178_provenance_redesign_migration into 454bfc3 on aiidateam:provenance_redesign.

sphuber and others added 3 commits December 11, 2018 13:12
The migrations consist of two steps:

 * Inferring the node process type of the node type
 * Migrating the node type, deleting illegal links and renaming links

The process type column was added sometime ago, which is used to store the
entry point string of the process class that led to the creation of the node.
This is mostly applicable for job calculations and workflows. Since the node
type is the same for all calculations and workflows, the process type is
necessary to keep the information of the process class that ran it.

Older databases may contain job calculations and workchains that were run before
the code was updated to include the process type. There the information for what
sub class, of especially the JobCalculation, was contained in the node type.
Since in this migration, the node type will be migrated to be just the base
CalcJobNode, with type string `node.process.calculation.calcjob.CalcJobNode.`,
the information of the calculation sub class would be lost. Therefore, before
migrating the node types, we attempt to infer the entry point string from the
node type string and store that in the process type column. Node type strings
that cannot be mapped on a known entry point string will get a fallback process
type string and are logged to a file.

After this is completd, a normal database migration is applied, where illegal
links are deleted, the remaining renamed according to the new rules and names and
the node types are renamed according to the new node ORM class type strings.
…lculation`

There has been a period, at the very beginning of the move to processes
where the node classes had the type `calculation.process.ProcessCalculation.`
These could represent either the execution of a workfunction or a workchain.

Therefore, we first convert all `ProcessCalculations` to `WorkCalculations`
and in a second step, we convert all `WorkCalculations` that have an attribute
called `function_name` to `WorkFunctionNode`. The only remaining `WorkCalculations`
then have to be `WorkChainNodes`.
The migration for the provenance redesign will delete illegal links such
as `return` and `call` links outgoing from calculation nodes. Since the
migration will simply delete them, before we do so, we detect these illegal
links, and if found will print a warning to the console and write the
offending links to a migration log file.

This way, the user could potentially restore the deleted links.
@sphuber sphuber force-pushed the fix_2178_provenance_redesign_migration branch from 5685025 to 6924089 Compare December 11, 2018 12:13
@giovannipizzi giovannipizzi merged commit 42bc788 into aiidateam:provenance_redesign Dec 11, 2018
@sphuber sphuber deleted the fix_2178_provenance_redesign_migration branch December 12, 2018 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants