Open smk762 opened 1 year ago
Good ideas! We can definitely work in this direction
Alternatively, a single unified task::status method which has awareness of which type of query/response is expected from a given task_id input value. e.g.
Won't it be confusing if a single RPC can respond with dozens (if not hundreds) of different data structures? Is it feasible to support this in GUIs?
Without a method which lists the tasks by id, it would be confusing. The unified method is optional, essentially just a wrapper around the others which would internally reference the ID : task
list. For GUI, the ID : task
list is enough to know which actual method to use for status query.
I though @smk762 meant to return IDs of the tasks, not the task data.
Won't it be confusing if a single RPC can respond with dozens (if not hundreds) of different data structures?
In addition to the initial question, it would be difficult to return the list of different tasks such as task::enable_z_coin::status
and task::withdraw::status
.
But I believe we could return multiple statuses for the same RPC method.
For example,
curl --url "$url:$port" --data "{
\"mmrpc\":\"2.0\",
\"userpass\":\"$userpass\",
\"method\":\"task::withdraw::status\",
\"params\": {
\"all\": true
}
,\"id\":0
}"
And response:
[
{
"task_id": 1,
"completed": false
},
{
"task_id": 3,
"completed": true
}
]
In this case we'll even be able to return the status payload as all of the tasks have the same response structure.
For example, task::init_trezor::status
results:
[
{
"task_id": 1,
"status": "Error",
"details": {
"error": "No Trezor device available",
"error_type": "HwError"
}
},
{
"task_id": 3,
"status": "UserActionRequired",
"details": "EnterTrezorPin"
}
]
I was recently overjoyed to find out there was a
forget_if_finished
param fortask::xxxx::status
methods. If it is not too much overhead, can we please make thisfalse
by default?Here's couple more ideas for ways to make checking in on previous tasks a bit simpler.
add a method like
view_tasks
which takes no params, but returns a dict of previous/current/tasks likecompleted
key/value can be omitted to reduce overhead,task_id
andstatus_method
is enough to make targeted query as needed.Alternatively, a single unified
task::status
method which has awareness of which type of query/response is expected from a giventask_id
input value. e.g.