|
| 1 | +.. |
| 2 | + Copyright 2021 Graviti. Licensed under MIT License. |
| 3 | +
|
| 4 | +############## |
| 5 | + Basic Search |
| 6 | +############## |
| 7 | + |
| 8 | +TensorBay supports basic search based on different commits. |
| 9 | + |
| 10 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 11 | + :language: python |
| 12 | + :start-after: """Authorize a Dataset Client Instance""" |
| 13 | + :end-before: """""" |
| 14 | + |
| 15 | +**************** |
| 16 | + BasicSearchJob |
| 17 | +**************** |
| 18 | + |
| 19 | +TensorBay SDK allows create, get or list :class:`~tensorbay.client.job.BasicSearchJob` via :class:`~tensorbay.client.version.BasicSearch`. |
| 20 | + |
| 21 | +Create |
| 22 | +====== |
| 23 | + |
| 24 | +A BasicSearchJob can be created by :func:`~tensorbay.client.version.BasicSearch.create_job` |
| 25 | + |
| 26 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 27 | + :language: python |
| 28 | + :start-after: """Create Job""" |
| 29 | + :end-before: """""" |
| 30 | + |
| 31 | +.. note:: |
| 32 | + #. conjunction |
| 33 | + The logical conjunction between search filters, which includes "AND" and "OR". |
| 34 | + #. unit |
| 35 | + The unit of basic search. There are two options: |
| 36 | + * "FILE": Get the data that meets search filters; |
| 37 | + * "FRAME": If at least one data in a frame meets search filters, all data in the frame will be get. This option only works on fusion dataset. |
| 38 | + #. filters |
| 39 | + The list of basic search criteria whose format is (key, operator, value, label_type). |
| 40 | + * "key": The factor for filtering, is a member of ["segment", "size", "withLabel", "frame", "sensor", "category", "attribute", "dataRemotePath"]. |
| 41 | + * "operator": The operation for filtering, is a member of ["like", "in", "=", ">", "<", ">=", "<="]. |
| 42 | + * "value": Reference value for filtering. |
| 43 | + * "label_type":The label type it belongs to when filtering by category and attribute. |
| 44 | + There are also some limits on operations of specific factor, and it lists as following: |
| 45 | + ================== =========================== |
| 46 | + key permitted operator |
| 47 | + ================== =========================== |
| 48 | + "segment" "in" |
| 49 | + "size" "=", ">", "<", ">=", "<=" |
| 50 | + "withLabel" "=" |
| 51 | + "frame" "like", "=" |
| 52 | + "sensor" "in" |
| 53 | + "category" "in" |
| 54 | + "attribute" "in" |
| 55 | + "dataRemotePath" "like", "=" |
| 56 | + ================== =========================== |
| 57 | + |
| 58 | +Get or list |
| 59 | +=========== |
| 60 | + |
| 61 | +The latest BasicSearchJob can be obtained by :func:`~tensorbay.client.version.BasicSearch.get_job` or :func:`~tensorbay.client.version.BasicSearch.list_jobs`. |
| 62 | + |
| 63 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 64 | + :language: python |
| 65 | + :start-after: """Get and List""" |
| 66 | + :end-before: """""" |
| 67 | + |
| 68 | +Get information |
| 69 | +=============== |
| 70 | + |
| 71 | +Available BasicSearchJob information includes ``title``, ``description``, ``job_id``, ``arguments``, ``created_at``, ``started_at``, ``finished_at``, |
| 72 | +``status``, ``error_message`` and ``result``. |
| 73 | + |
| 74 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 75 | + :language: python |
| 76 | + :start-after: """Get Job Info""" |
| 77 | + :end-before: """""" |
| 78 | + |
| 79 | +.. note:: |
| 80 | + If the BasicSearchJob is successfully completed, the result will be :class:`~tensorbay.client.search.SearchResult` or :class:`~tensorbay.client.search.FusionSearchResult`. |
| 81 | + See more details in :doc:`/features/search/search_result`. |
| 82 | + |
| 83 | +.. important:: |
| 84 | + Only the latest five search results for one dataset can be used. |
| 85 | + |
| 86 | +Update |
| 87 | +====== |
| 88 | + |
| 89 | +The latest information of a BasicSearchJob can be obtained after :func:`~tensorbay.client.job.Job.update`. Note that if the ``until_complete`` is |
| 90 | +set to ``True``, the BasicSearchJob will be blocked until it is completed. |
| 91 | + |
| 92 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 93 | + :language: python |
| 94 | + :start-after: """Update Job""" |
| 95 | + :end-before: """""" |
| 96 | + |
| 97 | +Abort or retry |
| 98 | +============== |
| 99 | + |
| 100 | +BasicSearchJob also supports :func:`~tensorbay.client.job.Job.abort` and :func:`~tensorbay.client.job.Job.retry`: |
| 101 | + |
| 102 | +.. literalinclude:: ../../../../docs/code/basic_search.py |
| 103 | + :language: python |
| 104 | + :start-after: """Abort and Retry Job""" |
| 105 | + :end-before: """""" |
0 commit comments