-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process: Add the
metadata.disable_cache
input (#6293)
Often, a user will want to have caching enabled by default, but in some specific cases disable it for a particular process. The `disable_caching` context manager was designed for such a use-case, however, this only affects the current Python interpreter and is therefore not useful when submitting to the daemon. The `metadata.disable_cache` input is added to the `Process` class. It is not set by default, but when set to `True`, the cache is completely disabled when storing the node. It overrides all other configuration rules that may be active. Since this value is set directly on the node through the process' inputs, its action will affect all interpreters including those of the daemon workers. To implement this, the `should_use_cache` method was added to the `NodeCaching` class. This simply returns the result of the `get_use_cache` utility function, which evaluates the caching configuration settings. This used to be called directly in the `Node.store` method, but by abstracting it, it can be overridden by the `ProcessNodeCaching` class, which can now return `False` if the `disable_cache` metadata input is set to `True`. Note that if it is not set or set to `False`, the input is ignored, keeping backwards compatibility. Since the value of the `disable_cache` is stored in the node's attributes under the `metadata_inputs` key, that key should be ignored when computing the hash of the node. If the key is included in the hash, then a process that explicitly specifies `disable_cache=False` would not be cached because the hash would not match a node that did not specify the input at all. The `metadata_inputs` contains all metadata inputs and not just the `disable_cache`, but the `_hash_ignored_attributes` currently does not support specifying nested keys. That doesn't matter though as the `metadata_inputs` should be ignored entirely anyway. The commit that introduced this key simply forgot to add it to the ignore list.
- Loading branch information
Showing
8 changed files
with
98 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.