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

aiidateam / aiida_core / 6648 / 5
74%
develop: 74%

Build:
Build:
LAST BUILD BRANCH: fix_3032_doc_working_importexport
DEFAULT BRANCH: develop
Ran 04 Jul 2019 12:55PM UTC
Files 403
Run time 27s
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 12:24PM UTC coverage: 68.072% (+0.002%) from 68.07%
TEST_AIIDA_BACKEND=django 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

21928 of 32213 relevant lines covered (68.07%)

0.68 hits per line

Source Files on job 6648.5 (TEST_AIIDA_BACKEND=django TEST_TYPE="tests")
  • Tree
  • List 0
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2239
  • Travis Job 6648.5
  • b9941f2d on github
  • Prev Job for TEST_AIIDA_BACKEND=django TEST_TYPE="tests" on fix_3119_calculation_function_caching (#6647.5)
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