-
Notifications
You must be signed in to change notification settings - Fork 24
Implement markers #217
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
Implement markers #217
Conversation
Signed-off-by: Yves Bastide <yves@botify.com>
-D, -W. Signed-off-by: Yves Bastide <yves@botify.com>
* marker.Marker(name, details)
* task.MarkerTask(name, details)
* workflow.record_marker(name, details=None)
-> return self.executor.record_marker(name, details)
* workflow.list_markers()
-> return self.executor.list_markers()
* abstract methods in the base executor
Signed-off-by: Yves Bastide <yves@botify.com>
Also add an example. Signed-off-by: Yves Bastide <yves@botify.com>
Signed-off-by: Yves Bastide <yves@botify.com>
|
(missing tests...) |
Add an option to show all the values of the markers, not just the last one. Signed-off-by: Yves Bastide <yves@botify.com>
|
^ damn, started to add tests but forgot to implement them... |
Signed-off-by: Yves Bastide <yves@botify.com>
This simplifies the simpleflow.swf.executor.Executor#submit casts. Signed-off-by: Yves Bastide <yves@botify.com>
| def wait_signal(self, name): | ||
| return self.executor.wait_signal(name) | ||
|
|
||
| def record_marker(self, name, details=None): |
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.
Why not a serializable object for details ?
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.
Yep, this should be better.
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.
Agreed, would be nice :)
Don't expect a string for `record_marker`'s `details` argument; instead,
serialize it and unserialize in `list_markers`.
* json_dumps/json.loads
* add serializers to _serialize_complex_object:
* datetime.date
* datetime.time
* uuid.UUID
* update test
Signed-off-by: Yves Bastide <yves@botify.com>
The "+00:00" TZ was expected by some tests; we now replace it with "Z". Oops. Signed-off-by: Yves Bastide <yves@botify.com>
| self.details = details | ||
|
|
||
| def __repr__(self): | ||
| return '<{klass} {name!r} details={details!r}>'.format( |
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.
Didn't know the conversion flags, nice! :)
simpleflow/swf/executor.py
Outdated
| )) | ||
| self.after_replay() | ||
| self.decref_workflow() | ||
| if self._append_timer and not self._timer_scheduled: |
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.
self._timer_scheduled seems to not be used anymore in current code?
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.
Totally unused, it's for some future timer PR 🙂
I'll add an explanation
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.
... No, better remove it
| def wait_signal(self, name): | ||
| return self.executor.wait_signal(name) | ||
|
|
||
| def record_marker(self, name, details=None): |
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.
Agreed, would be nice :)
Signed-off-by: Yves Bastide <yves@botify.com>
Signed-off-by: Yves Bastide <yves@botify.com>
Based on a comment by @ampelmann. Signed-off-by: Yves Bastide <yves@botify.com>
Signed-off-by: Yves Bastide <yves@botify.com>
Try to load a string; if this fails, return the string itself. Useful when the callee doesn't return a JSON-formatted result... Signed-off-by: Yves Bastide <yves@botify.com>
Signed-off-by: Yves Bastide <yves@botify.com>
Signed-off-by: Yves Bastide <yves@botify.com>
|
👍 ; needs more work before merging @ybastide ? |
|
Nope (well, we'll have to discuss #222 later): let's merge and release! |
Issue #216