-
Notifications
You must be signed in to change notification settings - Fork 93
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
Improve handling of custom task outputs #2364
Conversation
22e89d4
to
e6a496c
Compare
I like this, just wondering whether we need the 'trigger' recorded (in what you refer to as |
This is broadly true for the latest implementation. However, I have now modified the |
e6a496c
to
f7b856b
Compare
Branch re-based. |
Roger that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of very minor points.
return len(res) > 0 | ||
res = self.suite_state_query(task, cycle, status, message) | ||
if status: | ||
return bool(res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this bool
just checking for a non-empty list?
Note that:
>>> bool(None)
False
>>> bool([None])
True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res
should be a list, so this is testing for a non-empty list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case I'm OK with this.
lib/cylc/rundb.py
Outdated
r"LEFT OUTER JOIN " + | ||
r" %(task_outputs)s " + | ||
r"ON %(task_pool)s.cycle == %(task_outputs)s.cycle AND " + | ||
r" %(task_pool)s.name == %(task_outputs)s.name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not suggesting a refactor of this here but to note [for the future] that python's implicit string joining syntax...
('a'
'b'
'c')
...is O(1) whereas string operators...
('a' +
'b' +
'c')
...are O(N) - and also a little messier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must say that I have always found this sort of thing surprising (or is it disappointing?) with Python. Surely, Python should optimise this away at compile time...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprising, no, disappointing, yes.
Store custom outputs in separate DB table. Correcyly load completed custom outputs on restart. Fix job.status exit time on failure. Fix DB task jobs run exit time format.
f7b856b
to
5864bc6
Compare
On resetting a held task to submitted/running, ensure that the status is set to submitted(held)/running(held) instead of held(submitted/running). On shutdown, ensure that database is written last.
905514f
to
2b510b0
Compare
(Finally got test to pass on Travis CI!) |
lib/cylc/scheduler.py
Outdated
self.suite_db_mgr.process_queued_ops() | ||
self.suite_db_mgr.on_suite_shutdown() | ||
except StandardError: | ||
ERR.error(str(exc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except StandardError as exc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, haven't uncovered any problems.
Store custom outputs in separate DB table
task_outputs
.outputs
column of the row. The value is a multi-line string, each line is atrigger=message
pair.task_events
table.cylc suite-state
to query the new table instead oftask_events
.Correctly load completed custom outputs on restart.
Fix
job.status
exit time on failure.failed
argument tocylc message
on failure.Fix DB task jobs run exit time format.
Close #2361. Close #2362.