DMTF / Redfishtool

A Python34 program that implements a command line tool for accessing the Redfish API.
Other
224 stars 68 forks source link

Make async tasks blocking by default #80

Closed billdodd closed 4 years ago

billdodd commented 4 years ago

Redfishtool currently treats 202 Accepted responses from async tasks as successful and returns immediately. In most cases, the user will want the tool to wait for the async task to complete so the tool output can show the ultimate result of the task and so that subsequent tool invocations that rely on the completion of the async task can proceed.

This PR makes async tasks block by default. It also adds the additional option --NonBlocking (or -N) to indicate that the tool should NOT wait for the async task to complete.

In the blocking case, the tool displays a "Task is Running" message to STDERR (so as to not pollute the JSON output that is normally printed to STDOUT).

In the non-blocking case, the tool displays a "NonBlocking: Task Monitor is " message to STDERR.

Also note that this PR adds an additional third-party package requirement: python-dateutil

Fixes #77

mraineri commented 4 years ago

Would like to make "blocking" the default behavior, and have the option to make "non-blocking". Some folks wondering if this would be a negative impact for folks; generally thinking this isn't a problem since most people are expecting the operation to complete and have the response.

While blocking, could we print something out to indicate it's being blocked? Would be useful, but there is the potential concern of a script expecting a JSON object printed, and having something non-JSON printed might break the script.

What about the non-blocking case in terms of what needs to be shown? The Location header isn't shown today, and the service doesn't need to return the Task object in the 202 response.

mraineri commented 4 years ago

Approved 4/23