Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
integration: added HaystackAction #398
base: main
Are you sure you want to change the base?
integration: added HaystackAction #398
Changes from 4 commits
660a268
f88037e
8f731b9
0b24192
dc421d0
f2bc122
82ee637
f9e171b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should probably validate that writes doesn't have a duplicate mapping, given that it's the values.
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 changed some mappings to ensure
reads={socket: state_field}
andwrites={state_field: socket}
.This seems to make the most sense because:
reads
, each key should be unique and map to a unique kwarg ofComponent.run()
. The same state value could be passed to different kwargswrites
, each key should be a unique state field. Even thoughComponent.run()
returns a dictionary where keys are unique, we want to prevent calling.update()
on the same field several times.In other words, this would be invalid:
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.
We should probably assign this in the constructor? Break it into a helper function.
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.
Regarding
.inputs()
, it is currently a property, but it's return value may change if we allow a.bind()
method. What was previously a required/optional input is now bound.If
.bound()
is removed, then yes we could set values in__init__()
It seems that this logic belongs to
.inputs()
and wouldn't be of much use elsewhere.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.
Yeah,
.bound()
should return a copy of the object so the.inputs()
are frozen IMO. That said, this should take inbound_inputs
in the constructor, and we don't need a method? You don't really want properties dynamically computed like this, it's hard to debug and a bit iffy IMO.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.
So
bind
is only (currently) for functions, actions don't have it. Might be a bit confusing here, but if we like it, it should really be at theAction
level, as that makes a lot of sense IMO. Then it could just do this.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.
Otherwise we can make this a more specific name to not conflict
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.
If I understand, the pattern is to only allow
bound_params
at init? This affects theComponent.run()
methodThis would be ok:
This would not be ok?
I should simply remove the
.bind()
method?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 think so, or call it something else? Alternatively, we can make bind work at the action level. Currently it's only for functions, and class-based actions don't have it.
Large diffs are not rendered by default.