|
Post by ginugeorge on Dec 14, 2021 11:10:11 GMT
We have an assumption about what should be the actual purpose of a Task Monitor as mentioned below :
Please let us know if our assumption is correct ? if so, do help us to know what can be the actual use case of a Task Monitor wrt the DMTF Schema ?
If our assumption is wrong, please guide us as to what is the actual purpose of the Task Monitor with an example.
|
|
|
Post by mraineri on Dec 14, 2021 20:15:28 GMT
A "task monitor" is closely tied to a single task instance. It's the handle a client gets when it invokes a long running operation, and is also the handle the client uses to get the final status of the operation.
Thinking about it from a coding perspective...
response = invoke_redfish_operation() task_monitor_uri = response.headers.location while(response.http_status == 202) { response = http_get(task_monitor_uri) }
// Process final response ...
From a payload perspective, "task monitor" and "task" follow the same schema definition and contain the same contents, but have different URIs. "Task monitor" has the added semantic where the response to the GET operation on the task monitor when the operation is complete is the response to the initial request.
If a new task is created due to a client requesting a long operation, a new task monitor would also be created. I would never expect tasks or task monitors to be reused; that can create collisions when different clients may pick up each others tasks.
Task monitors, like tasks, are not necessarily persistent and can also be cleared out based on the manager's task retention policy; this would be up to the implementation to design support for if needed.
|
|
|
Post by AMI_Mani on May 5, 2022 18:57:52 GMT
Hi, Assume if implementation is not supporting taskmonitor attribute and support Tasks only. Taskmonitor attribute is not required attribute as per Taskresource schema(http://redfish.dmtf.org/schemas/v1/Task.v1_5_1.json) User can use task instance to check operation status and once operation completes, he can give get request to resource for seeing the changes In this case can we skip location header in response or give task instance in location header with task instance details in response body
Thanks, Mani
|
|
|
Post by puwen on May 6, 2022 5:25:37 GMT
task_monitor_uri = response.headers.location while(response.http_status == 202) { response = http_get(task_monitor_uri) }
// Process final response ...
Hi Mike,
I want to determine if this code is intended to represent what the spec says:
So if I use another expression it should be something like Step 3, right?
|
|
|
Post by mraineri on May 6, 2022 13:56:14 GMT
Hi, Assume if implementation is not supporting taskmonitor attribute and support Tasks only. Taskmonitor attribute is not required attribute as per Taskresource schema(http://redfish.dmtf.org/schemas/v1/Task.v1_5_1.json) User can use task instance to check operation status and once operation completes, he can give get request to resource for seeing the changes In this case can we skip location header in response or give task instance in location header with task instance details in response body Thanks, Mani While the property "TaskMonitor" is not mandatory in the Task resource, the task monitor itself is absolutely required per the Redfish Specification. The property "TaskMonitor" was added for administrative purposes so if a client lost track of the URI from the Location header, they can find it again in the Task resource.
|
|
|
Post by mraineri on May 6, 2022 14:09:51 GMT
task_monitor_uri = response.headers.location while(response.http_status == 202) { response = http_get(task_monitor_uri) }
// Process final response ...
Hi Mike, I want to determine if this code is intended to represent what the spec says: So if I use another expression it should be something like Step 3, right? This flow isn't really correct. The curl operations are all on the Task resources themselves, which would never return a 202. The client would be polling the progress of the task via the task monitor returned in the Location header.
Keep in mind, the semantics for the Task resource and task monitor are very different; the Task resource would always return a 200 and the response body would contain the representation of the task, whereas a task monitor returns either 202 with the task status OR the final results of the operation (if the task is completed).
|
|
|
Post by puwen on May 6, 2022 15:42:46 GMT
This flow isn't really correct. The curl operations are all on the Task resources themselves, which would never return a 202. The client would be polling the progress of the task via the task monitor returned in the Location header. Keep in mind, the semantics for the Task resource and task monitor are very different; the Task resource would always return a 200 and the response body would contain the representation of the task, whereas a task monitor returns either 202 with the task status OR the final results of the operation (if the task is completed).
Hi Mike, I'm confused by this term: [task monitor]. I use curl to do "ForceOff" and find the "Location" from the headers of the response. Doesn't this URI represent [task monitor]? If it is not task monitor, could you please provide a real example, thanks. # curl -sk -u 'admin:admin' --request POST 'https://<Redfish IP>/redfish/v1/Systems/Self/Actions/ComputerSystem.Reset' \ --header 'Content-Type: application/json' \ --data-raw '{ "ResetType": "ForceOff" }' -v
> POST /redfish/v1/Systems/Self/Actions/ComputerSystem.Reset HTTP/1.1 > Host: 192.168.236.174
< HTTP/1.1 202 Accepted < Location: /redfish/v1/TaskService/Tasks/1
{ "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.id": "/redfish/v1/TaskService/Tasks/1", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for Computer Reset", "Id": "1", "Name": "Computer Reset", "TaskState": "New" }
|
|
|
Post by mraineri on May 6, 2022 21:47:10 GMT
This flow isn't really correct. The curl operations are all on the Task resources themselves, which would never return a 202. The client would be polling the progress of the task via the task monitor returned in the Location header. Keep in mind, the semantics for the Task resource and task monitor are very different; the Task resource would always return a 200 and the response body would contain the representation of the task, whereas a task monitor returns either 202 with the task status OR the final results of the operation (if the task is completed).
Hi Mike, I'm confused by this term: [task monitor]. I use curl to do "ForceOff" and find the "Location" from the headers of the response. Doesn't this URI represent [task monitor]? If it is not task monitor, could you please provide a real example, thanks. # curl -sk -u 'admin:admin' --request POST 'https://<Redfish IP>/redfish/v1/Systems/Self/Actions/ComputerSystem.Reset' \ --header 'Content-Type: application/json' \ --data-raw '{ "ResetType": "ForceOff" }' -v
> POST /redfish/v1/Systems/Self/Actions/ComputerSystem.Reset HTTP/1.1 > Host: 192.168.236.174
< HTTP/1.1 202 Accepted < Location: /redfish/v1/TaskService/Tasks/1
{ "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.id": "/redfish/v1/TaskService/Tasks/1", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for Computer Reset", "Id": "1", "Name": "Computer Reset", "TaskState": "New" }
Yes, the Location header contains the URI of the task monitor. However, in your example, the URI is identical to the Task resource. The Task resource URI and task monitor URI are two different URIs with different behavioral semantics.
|
|
|
Post by puwen on May 7, 2022 1:46:41 GMT
Yes, the Location header contains the URI of the task monitor. However, in your example, the URI is identical to the Task resource. The Task resource URI and task monitor URI are two different URIs with different behavioral semantics. Hi Mike, Thanks, your explanation is very clear. It seems that the behavior of AMI Code Base is confusing the difference between [Task Monitor] and [Task Resource] as I did. But there is another question, which schema should [Task Monitor] use? There are two task-related schemas in DSP268, one is [Task] and the other is [TaskService]. I didn't find the schema for [Task Monitor].
|
|
|
Post by AMI_Mani on May 7, 2022 9:10:43 GMT
Hi Mike, Can we add more details about Task monitor in specification or in schema? We have below details in Schema and no further details of TaskMonitor resource in Specification(like URI, attributes etc) "TaskMonitor": { "description": "The URI of the Task Monitor for this task.", "format": "uri-reference", "longDescription": "This property shall contain a URI to Task Monitor as defined in the Redfish Specification.", "readonly": true, "type": "string", "versionAdded": "v1_2_0" },
Please make sure Task Monitor as mandatory attribute in Taskresource schema(http://redfish.dmtf.org/schemas/v1/Task.v1_5_1.json) so that there won't be any conflict Basically Task monitor is used to represent the response of resource after long-running operation completes and there is no standard schema for task monitor as of now I have already replied related to schema in redfishforum.com/thread/340/redfish-service-validator-related-instance?page=1&scrollTo=2310Can we think possibility of using Task resource itself instead of bringing task monitor? Initially we used Task instance only and later Task monitor was introduced but we need more details like schema, clean up(policy) etc. to use properly if we need to use mandatory. Copied earlier specification details for reference 202 Accepted The request has been accepted for processing, but the processing has not been completed. The Location header shall be set to the URI of a Task resource that can later be queried to determine the status of the operation. A representation of the Task resource may be included in the response body. Thanks, Mani
|
|
|
Post by mraineri on May 11, 2022 22:38:51 GMT
The task monitor is not a Redfish resource in the sense of how the data model is constructed; it's a special URI with specific behavior called out in the specification.
Again, the "TaskMonitor" property is not mandatory in the Task resource; think of cases where a task is complete, but the monitor is no longer available. It's possible a service still maintains information about the task, but needs to clean up its usage of the monitor.
Using the Task resource itself I do not think is an option. Remember, monitoring tasks from a client perspective has very different semantics than simply querying all tasks. Clients use the status codes from the URI of the task monitor to understand how to govern their flow of operation. In addition, when the operation is finally complete, the response body for a task monitor will not be a Task resource. This is why they are two different URIs: Task resource URIs are much more static in nature and used by administrators to see what operations are outstanding/complete, whereas task monitors are the breadcrumbs clients use to poll an operation to completion. It really isn't possible to make the two the same URI.
|
|
|
Post by AMI_Mani on May 24, 2022 10:27:35 GMT
Thanks for details. I got your point related to TaskMonitor" property is not mandatory in the Task resource; think of cases where a task is complete, but the monitor is no longer available
Can we make taskmonitor value as null once task is complete, so that task monitor always comes in response?
Thanks, Mani
|
|
|
Post by mraineri on May 24, 2022 13:39:19 GMT
No, in that case the property should be removed from the payload. Null is used to indicate to the client that a value is currently not available and they should come back later to see if the value is available. In this case, if the task is complete and the task monitor is no longer needed by the client, such as when they've read the final state of the operation or other cleaning logic needs to take place, then the property simply no longer applies to the resource.
|
|
|
Post by AMI_Mani on May 25, 2022 3:21:06 GMT
Hi Mike, We have below details in specification
If an implementation supports a property, it shall always provide a value for that property. If a value is unknown
at the time of the operation due to an internal error, or inaccessibility of the data, the value of null is an
acceptable value if supported by the schema definition.
Based on above details, can we expect Taskmonitor always comes in response or we have to follow 9.11 Special resource situations , omit the Taskmonitor once task completed
Another clarification
1. Do we need to provide Taskmonitor Instance response(Once task is completed and return actual response) always for user irrespective of current state? Assume current state has different values and when they check Taskmonitor Instance response(Assume task complete long back). Another option is to show response only once after completed and then delete that Taskmonitor Instance response 2. Do we need to provide options like Delete method for Taskmonitor Instance so that user can clean up completed task or needs to apply policy to delete old ones automatically?
Thanks, Mani
|
|
|
Post by mraineri on May 25, 2022 18:46:51 GMT
This would fall under the "Special resource situations" clause; the property simply does not apply in this case. For the other follow up questions, this is a matter of your design. It's not necessary the implementation internally deletes the task monitor at all. Depending on the architecture of the implementation, the task monitor could...
- Remain until the service reboots
- Remain until the Task resource is deleted
- Remain forever
- Remain until the client performs a GET operation on the task monitor and the operation is complete
- Remain for one hour after the operation has completed
- Many others...
In the end it's entirely up to your implementation's constraints for how long the task monitor lives. However, DELETE is an allowable operation on a task monitor. A client polling a task monitor may perform DELETE to cancel the operation (assuming cancelation of the operation is supported by the service).
|
|