[openstack-dev] [mistral] Pike limit of 100 results makes debugging much harder

Bob Haddleton bob.haddleton at nokia.com
Thu Nov 9 16:13:51 UTC 2017


The Pike release of python-mistralclient added a default limit of 100 
results returned to ease the burden on the database, which makes sense 
because it's rare that anyone actually needs all of the results that are 
returned.

Unfortunately with the default sort order of "asc" this means that only 
the first 100 results are returned, so when debugging workflows and 
running task-list, execution-list, and action-execution-list, the data 
needed is not returned by default once there are more than 100 
tasks/executions/action-executions in the database.

It's possible to work around this by specifying --limit <some large 
number> assuming that the number you specify is greater than the number 
of tuples in the database.  The help text says that --limit -1 will 
result in no limit but there is a bug [0] that results in an error from 
the API instead.  It's also possible to specify the execution id (when 
listing tasks) or the task id (when listing action-executions) but this 
adds additional steps to the process to find these IDs, when really all 
you want is the last 100 results.

Even if the --limit -1 worked it's still not optimal to hit the database 
that hard while debugging just so you can see the latest results of your 
workflow/task/action executions.

Ideally the default would return the _last_ 100 results, (limit = -100) 
which is more likely to contain the information needed for debugging a 
workflow.

We could add a --sort-dir option to the task/execution/action-execution 
list commands to allow for descending sort order, which combined with 
the default limit would return the last 100 results but in descending 
order instead of ascending order, which means the latest results would 
likely scroll off the screen.  A second sort would be required to put 
them in ascending order.

Is there a way to "retrieve the last <limit> results in ascending order" 
from SQLAlchemy without doing a second sort in the client?

Thanks

Bob

[0] https://bugs.launchpad.net/python-mistralclient/+bug/1730755



More information about the OpenStack-dev mailing list