-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added feature to enable or disable rules #1103
Conversation
Two thoughts on this. Explicit enablement and disablement would be nice, especially for potential parallel write interactions. It would be nice if a disabled rule would be identifiable by criteria other than all lines being commented out. |
Hi both, The ability to disable/enable rules may be in great demand! It would also be nice to have an option to disable the Rules and Feeders sections independently, as well as specify whether Skipcheck, Feedstrings and Undefvals should be disabled. It might also be worth considering adding an additional check when enable = True to ensure that the rule was previously disabled. Otherwise, if you accidentally run a function with enable = True without first disabling it, it may cause the actual comments to be uncommented. |
Thanks for the input on this one @vmitsenko
If we disable only the feeders, we should get all the performance gains without breaking the rule calculations, right? I like this idea. It is kinda contrary to the direction the PR has evolved though. Now, we disable the entire rule by replacing it with a commented b64-encoded version of the rule text. Perhaps we can combine both approaches? |
This is getting interesting! |
- added prefix to disabled rule
Apologies, I didn't notice the second commit, it makes more sense now, thanks for the explanation. Having 4 functions sounds good to me. The only thing is that I was unable to complete the write operation when using disable_cube_rule with b64-encoding: The following test fails with the error "CubeCellWriteStatusRuleApplies": `
` |
# Conflicts: # Tests/CubeService_test.py
Hi @vmitsenko
It is due to how the construct_body function works on the Cube class: if self.has_rules:
body_as_dict['Rules'] = str(self.rules)
return json.dumps(body_as_dict, ensure_ascii=False) When a rule is completely commented the .has_rules property return False. If we make it look at the body of a rule: if self.rules.text:
body_as_dict['Rules'] = str(self.rules)
return json.dumps(body_as_dict, ensure_ascii=False) then it works fine as shown in the new unit test script. Let me know your thoughts! nico |
I added a commit on top. But I had to do it in #1106 I don't think we need different sections, TBH. def disable_rules(self, cube_name: str) -> None:
...
def disable_feeders(self, cube_name: str) -> None:
...
def enable_rules(self, cube_name: str) -> None:
...
def enable_feeders(self, cube_name: str) -> None:
... I also separated the string manipulation from the API stuff. That's convenient for the test cases. Rest should be the same. Let me know what you think! |
closed in favor of #1106 |
To implement on enhancement #1102