Skip to content
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

Add an 'event' command #941

Open
danielballan opened this issue Jan 3, 2018 · 5 comments
Open

Add an 'event' command #941

danielballan opened this issue Jan 3, 2018 · 5 comments

Comments

@danielballan
Copy link
Member

danielballan commented Jan 3, 2018

Suggestion by @tacaswell which I am just recording:

Add an 'event' command so that

Msg('create')
Msg('read', obj1)
Msg('read', obj2)
Msg('save')

can be accomplished by

Msg('event', [obj1, obj2])

There is really no reason one should need to interleave other commands between these; there is no situation we can think of where 'event' is not sufficient. [edit: see next comment] This is a nice simplification.

@danielballan
Copy link
Member Author

Having just written that, I have just thought of one such situation where we need 'create' / 'save' -- the case where we want a plan to be able to see a reading before the Event is created and decide whether to 'save' or 'drop'. I therefore amend my previous statement: the proposed 'event' command is a nice simplification for the common case, reducing the number of messages per plan, but 'create' and 'save' still have an important use.

@prjemian
Copy link
Contributor

prjemian commented Jan 3, 2018

Will a description document be generated that relates to this event document? Will there be a 1-to-1 relationship for such description documents when an event is generated this way?

@danielballan
Copy link
Member Author

Yes, the behavior of the RunEngine would be precisely identical in these two modes. It simplify removes the overhead of processing multiple Msgs.

@prjemian
Copy link
Contributor

prjemian commented Jan 3, 2018

I think I understand. Consider this scenario:

Msg('event', [obj1, obj2])
Msg('event', [obj1, obj2])

generates two descriptor documents, essentially duplicates but for UUID.

If so, can some smarts be added in RE to see if a descriptor has already been generated for the same signal list: [obj1, obj2]?

@danielballan
Copy link
Member Author

Yes, in fact those smarts already exist:

Msg('create')
Msg('read', obj1)
Msg('read', obj2)
Msg('save')  # in the RunEngine._save coroutine, the RunEngine builds and emits a new Descriptor and then the Event
Msg('create')
Msg('read', obj1)
Msg('read', obj2)
Msg('save')  # in the RunEngine._save coroutine, the RunEngine finds that it already has emitted an appropriate Descriptor and merely emits the Event

I would apply the same logic to

Msg('event', [obj1, obj2])  # emit Descriptor, Event
Msg('event', [obj1, obj2])  # emit Event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants