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

Passing algorithm specific arguments in getQuery and processAnswer #146

Open
stsievert opened this issue Sep 28, 2016 · 2 comments
Open
Milestone

Comments

@stsievert
Copy link
Member

stsievert commented Sep 28, 2016

I ran into a use case today where @sumeetsk was developing an application where he had two different algorithms that needed a different set of parameters for getQuery and processAnswer (some elements common, others not).

To support this, I see three choices:

  1. Enforce that all algs accept arbitrary keyword arguments (through def getQuery(..., **kwargs)). This is the current functionality, and is not preferred (why should an algorithm developer have to modify every other algorithm to get a special argument?)
  2. Modify the wrapper. We can look at the function signature and see what optional arguments the algorithm function can accept and pass in those. This would mean that the app developer would be encouraged to pass in every argument that any algorithm needs (which may be expensive).
  3. Modify myApp.py. We could provide an alg.name to the algorithm developer and they can write an if-statement to see which arguments they want to pass.

Daniel and I discussed this today, and we're not inclined to go with option 2. Our main motive for going with option 3 was that we were doing less and leaving more up to the user -- this provides more flexibility and an explicit explanation of what's going on.

@stsievert stsievert added this to the v1.1 milestone Sep 28, 2016
@stsievert
Copy link
Member Author

stsievert commented Sep 29, 2016

The issue @sumeetsk is facing has to do with information about the query_uid. In App.py#L150 this is generated after myApp.getQuery for no real reason -- I don't see anything blocking passing the query_uid to myApp.py and editing base.yaml to reflect this.

In general, I still think option 3 is best and I'm sure another use case like Sumeet's will pop up. I still propose adding a name parameter to the alg wrapper we pass to myApp.py.

@stsievert
Copy link
Member Author

stsievert commented Sep 30, 2016

@sumeetsk's problem is addressed by bd3b1f4 (which is not the related to passing in different arguments).

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

1 participant