diff options
author | Richard Maw <richard.maw@gmail.com> | 2014-10-01 15:11:03 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2014-10-01 15:11:03 +0000 |
commit | b40fb0e408c23277aa6f3c505baaf531d18ffcba (patch) | |
tree | 6d47ff8d9e07cdb6be48175c4fbe40cdfde93b9e | |
parent | 01ae89708994a7b3baa59683d2e264b5c6e3bd42 (diff) | |
download | morph-b40fb0e408c23277aa6f3c505baaf531d18ffcba.tar.gz |
Allow default split rules to be overridden in-code
This is needed for distbuild to deserialise based on the split rules on
the node that did the graph calculation, rather than the node that does
the building.
-rw-r--r-- | morphlib/artifactsplitrule.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/morphlib/artifactsplitrule.py b/morphlib/artifactsplitrule.py index cf0d1060..1511d694 100644 --- a/morphlib/artifactsplitrule.py +++ b/morphlib/artifactsplitrule.py @@ -230,7 +230,7 @@ DEFAULT_STRATUM_RULES = [ ] -def unify_chunk_matches(morphology): +def unify_chunk_matches(morphology, default_rules=DEFAULT_CHUNK_RULES): '''Create split rules including defaults and per-chunk rules. With rules specified in the morphology's 'products' field and the @@ -246,7 +246,7 @@ def unify_chunk_matches(morphology): split_rules.add(ca_name, FileMatch(patterns)) name = morphology['name'] - for suffix, patterns in DEFAULT_CHUNK_RULES: + for suffix, patterns in default_rules: ca_name = name + suffix # Explicit rules override the default rules. This is an all-or-nothing # override: there is no way to extend the default split rules right now @@ -257,7 +257,7 @@ def unify_chunk_matches(morphology): return split_rules -def unify_stratum_matches(morphology): +def unify_stratum_matches(morphology, default_rules=DEFAULT_STRATUM_RULES): '''Create split rules including defaults and per-stratum rules. With rules specified in the chunk spec's 'artifacts' fields, the @@ -284,7 +284,7 @@ def unify_stratum_matches(morphology): for d in morphology.get('products', {})): match_split_rules.add(sta_name, ArtifactMatch(patterns)) - for suffix, patterns in DEFAULT_STRATUM_RULES: + for suffix, patterns in default_rules: sta_name = morphology['name'] + suffix # Explicit rules override the default rules. This is an all-or-nothing # override: there is no way to extend the default split rules right now |