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
Return value concept #1218
Comments
@yarikoptic favors a system where the return values reflect the end result and not the completed process. That means, for example, that an identical re-invocation of The downside of such approach is that it becomes harder to not act on things that aren't new -- a use-case that seems as legitimate (e.g. kick of some processing for any new file in a dataset). Of course this could be done by some form of The status quo is that there is absolutely no consensus. One way would be a switch to more complex return values that indicate the kind of processing applied, as well as the status. Based on such return values, as result renderer could make a (configurable) decision what kind of return value is desired. We could distinguish between 'direct' results (i.e. ones that correspond to an explicit input argument), 'indirect' results (i.e. ones that happened to also become results, e.g. files that git-annex reports because we asked it to get everything in a directory), and 'none results' (stuff that is there, but wasn't a result of the invoked command, previously existing content, ....). I am not very confident that such a solution is easy to implement in a consistent fashion, though. |
Well, I think we can have it all as far as concerns the CLI. If the python API returns detailed JSON-like dicts, we can have consistent entries for each item, indicating whether the item was indirectly addressed, whether it was actually processed, whether the state after the command "fulfills the promise" and so on. At that level we would have all the information. Then we would have (consistent) options for the result renderers to determine, what information will actually be spit out. |
may be inline with what is suggested above may be not -- what if, somewhat inline with git-annex, we return/generate dicts with consistent keys: object, success, note (optional additional information), performed_actions. e.g. for install
here in the 2nd case that dataset already existed. although not sure if I would like this to be returned by default, so we might indeed to have it as an option for a call (again -- similar to git-annex's "--json") |
Basically in line, yes. |
Just a note on existing ActivityStats which is used to summarize activities done by the crawler ATM. It might become extended/used also to present stats for other actions |
Started playing with this. Here is my current concept:
each result has the following fields:
Based on this information we would have generic result renderers that could be selected on a case by case basis (for scripting, JSON, debugging, ...). The renderer would also take care of raising the proper error depending in a general "mode" setting (fail on incomplete results, or not). I am skeptical about having @bpoldrack @yarikoptic Yes? |
We need to distinguish:
|
May be we need a |
It is not about detail, but the distinction of success (even due to a
non-action) or failure due to the inability to perform.
…On Feb 20, 2017 18:15, "Benjamin Poldrack" ***@***.***> wrote:
May be we need a status_detail additionally. This could hold the reason
for skipping as well as additional details on 'incomplete' if available.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1218 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIVH-jjPsWUQqyKWrLMBJCL6V2_sG7wks5recpGgaJpZM4LtL9A>
.
|
Well, success evaluation can consider both fields, so this isn't really a con. But I agree - it's different from details on 'incomplete' for example. |
To conclude:
The first two to not lead to an error message/code. The two latter ones do. |
My plan is to introduce a new decorator that implements result inspection, filtering, and "error generation" to gradually introduce this feature for commands that were RF'ed to support it. |
Sounds good to me. |
Sorry, missed why |
"incomplete" is something you infer from the list of results. Any occurance of 'impossible', or 'error' implies incomplete. |
I request one file |
You request one file, you did not get it (status for that get action and this file is error) -> any(status in ('impossible', 'error') -> True -> Incomplete. |
Closing this now. Much more info and code is in #1350 -- no way back. |
discuss and redo the return value concept. It seems that we are moving towards a JSON-like concept where we would need to return a list of dicts that contain info on an item and the status/result of an action.
The text was updated successfully, but these errors were encountered: