-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Expose conditions #44
Conversation
That is unnecessary and no longer should be used.
Failed as True has no attribute observe
This subpackage contains medium layer API to the conditions. Easier than raw condition classes.
Comparisons were as strings instead of ints when created using string syntax.
These are no longer used.
For some reason TaskCond broke. It's due to that pydantic respects the classvar order and for some reason that got affected even though the attributes were not changed. Maybe it is relying on very fine state that is slightly random.
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
==========================================
- Coverage 90.08% 89.83% -0.26%
==========================================
Files 81 83 +2
Lines 3652 3747 +95
==========================================
+ Hits 3290 3366 +76
- Misses 362 381 +19
Continue to review full report at Codecov.
|
Also removed the default setting functions as these are no longer used.
This allows using the func name in Return as well
If session.task_exists is tested the code coverage goal is probably reached. The cov decreased due to removal of unneeded code (which was tested). |
This is quite a massive update. Nothing already documented will change but quite a lot under the hood.
Most notable changes:
Introduction of easy to use conditions
These are convenient alternatives for those who prefer Python objects instead of the string syntax. These are exact equivalents:
and
Pick which style suits you.
Parametrizable conditions
Previously the conditions used sessions and tasks in quite an ugly way. They relied on that they are mutable and
Now instead of using
bool(condition)
, this should be used instead:condition.observe(session=session)
. The context is given when evaluating instead of embedding the context inside.In addition, this allows easier custom conditions and conditions support for passing the context out of the box similarly as parametrization in tasks work. Actually, they now share the mechanism.
Easier reference
Now these are also possible:
app.cond()
now returns the condition itself. There could be problems with pickling but conditions are not passed to processes.Also, reference in
Return
is also simpler:Note how we did not pass the task name as a string but just the function. The task name is stored in the function as
do_first.__rocketry__['name']
.