-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
BUG: fix SIA2 session inheritance #490
Conversation
Codecov Report
@@ Coverage Diff @@
## main #490 +/- ##
=======================================
Coverage 80.01% 80.01%
=======================================
Files 52 52
Lines 6039 6039
=======================================
Hits 4832 4832
Misses 1207 1207
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
If I see correctly, all CI failures are due to |
On Tue, Sep 26, 2023 at 04:45:28PM -0700, Brigitta Sipőcz wrote:
If I see correctly, all CI failures are due to `dc.g-vo.org` being offline.
Yeah, that was an earthmover proving that true reduncancy is hard to
achieve in internet and power connections.
In case you want to re-try, things are back to normal in Heidelberg.
|
@@ -221,7 +219,7 @@ def search(self, pos=None, band=None, time=None, pol=None, | |||
instrument=instrument, data_type=data_type, | |||
calib_level=calib_level, target_name=target_name, | |||
res_format=res_format, maxrec=maxrec, | |||
session=session, **kwargs).execute() | |||
session=self._session, **kwargs).execute() |
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 don't know if this concern is a big deal, but if someone right now sends passes their own session when calling the search
method, that would be silently ignored. The alternative is to look for the session into kwargs
and use that one if available. At least temporarily.
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.
Shouldn't they have used that session in their instance init? (as far as I see we basically pass on self._session
at this point in the other classes, too (though sometimes it happens in the create_query
method, rather than this high up.)
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 this is an interesting question. I understand the concern but feel like breaking someone's existing behavior is unlikely. If we find this is a problem moving forward, we can come back and address it again. The use of kwargs
throughout this code makes tracking some of the parameters challenging.
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 agree about kwargs
. If I'm not mistaken, these arguments are intended primarily for the requests
underlying library so it's easy for someone to specify things like timeout
, headers
, etc with call. Maybe that's too confusing and we need to add a request attribute map in the service class for that more expert-use purpose.
The bottom line is that we are essentially removing sessions
from the list of arguments, silently without giving any warning. There might not be any users of this feature, but if there are, they will have a very hard time understanding what is going on.
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've tried to trace some of these kwagrs, and they ended up being an rendered out to be attributes, most of not being used at all. So, if the aim is to pass them along all the way to request
, then I would suggest to add a request_kwargs
parameter that accepts an dict.
But changing it all at this point would potentially painful for users (though I would say any errors would be easy to fix, or in fact directly highlighting bugs in their usage.
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'm OK with request_kwargs
. And a deprecation warning when kwargs
is not empty? A pain, I know, but the right etiquette.
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'll check, even the deprecation decorators may work, I just never tried them for **
cases.
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 feel I'm just a broken record with the same ideas (#466) 😅
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.
This looks good to me.
To close #487