SEL-Columbia/pybamboo

Unable to retrieve empty lists from bamboo

Closed this issue · 5 comments

@pld @mejymejy @prabhasp
Ah! Almost crashed my head on my desk for this one.

@retry decorator loops on bamboo request until the result is True.
Only problem is that valid responses like [] (empty list) are not evaluated to True and thus we loop for no reason and end-up receiving False instead of the desired list.

I don't get the point of this decorator so I'm not gonna change its behavior right away but I believe what we want is a try/catch on BambooError and that's it.

Please let me know.

I believe it's banged my head ;)
On Nov 27, 2012 9:28 PM, "rgaudin" notifications@github.com wrote:

@pld https://github.com/pld @mejymejy https://github.com/mejymejy
@prabhasp https://github.com/prabhasp
Ah! Almost crashed my head on my desk for this one.

@Retry decorator loops on bamboo request until the result is True.
Only problem is that valid responses like [](empty list) are not
evaluated to True and thus we loop for no reason and end-up receiving
False instead of the desired list.

I don't get the point of this decorator so I'm not gonna change its
behavior right away but I believe what we want is a try/catch on
BambooError and that's it.

Please let me know.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7.

@rgaudin yeah sorry about that... i figured that it wasn't too big of a deal for the time being, since it will just try a few times (~12 seconds or something). i made it so that you can disable the number of retries if you expect that it will return an empty list. though, i agree that it should return an empty list instead of False. maybe you can set the failure return value in a parameter or something...

not sure if the retry thing is cool or not... in the end

@mejymejy so… Can I change it to react on BambooError instead of return result ?

i think that it might actually be better to remove the retry decorator from the get_data function since we designed bamboo to just deliver whatever data is available at the time. there may or may not be additional calculations going on or imports but we just return whatever the state is at that time. going with this philosophy would mean that we just try once and you get what you get. @pld what do you think?

pld commented

That makes sense for now. If we have bamboo inform about those background actions, like we're more proactive with setting a dataset state to pending when there are background calculations running, we can incorporate something which checks state into this.