• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aiidateam / aiida_core / 6646 / 7
74%
develop: 74%

Build:
Build:
LAST BUILD BRANCH: fix_3032_doc_working_importexport
DEFAULT BRANCH: develop
Ran 04 Jul 2019 12:23PM UTC
Files 403
Run time 22s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Jul 2019 11:28AM UTC coverage: 69.652% (+0.006%) from 69.646%
TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests"

Pull #3121

travis-ci

web-flow
Short circuit execution of calculation functions when caching

The caching of `CalcFunctionNodes` was working properly, however, the
process would still be executed afterwards. Somewhat surprisingly this
did not seem to cause obvious side effects or exceptions elsewhere. The
symptom that brought this to light is the fact that the result node that
was returned was unstored, despite the actual outputs being stored and
recorded properly. The origin of the problem is that the caching takes
place in the `Node.store` method, which is called indirectly by the
`Process.on_entered` when the process is created. However, in the case
that the node is created from a cached node, the `Process` is not
informed and merrily continues on its way calling `run`.

This problem was already addressed in the `CalcJob` class, where in the
`run` method the node was checked whether it already had an exit status
attribute. This would mean the node was cached from an already finished
calculation and so the method returns immediately. Note that this works,
because for a `ProcessNode` to be even considered a valid cache node, it
has to be `finished_ok` meaning it always has an `exit_status` attribute.
See the `ProcessNode.is_valid_cache` property.

To fix the problem for calculation functions, we simply add the same
check. Note that we cannot easily abstract this to the parent `Process`
class and have the sub classes call the super first, because they will
then have to check the result of the super call and return the value if
it is not `None`, which is not necessarily a cleaner solution then the
code duplication solution chosen here.

Another thing to keep in mind is that this is now only done for the
`FunctionProcess` and `CalcJob` process classes so the check is not
applied for the `WorkChain`. However, for now this is not problematic
since `WorkChainNodes` are not cachable anyway.
Pull Request #3121: Short circuit execution of calculation functions when caching

22437 of 32213 relevant lines covered (69.65%)

0.7 hits per line

Source Files on job 6646.7 (TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests")
  • Tree
  • List 0
  • Changed 4
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2237
  • Travis Job 6646.7
  • 306601f9 on github
  • Prev Job for TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests" on fix_3119_calculation_function_caching (#6644.7)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc