Skip to content

Commit 187f188

Browse files
Merge pull request #862 from ixcat/issue-804
add docs-parts/computation/06-distributed-computing_jobs_by_key.rst (#804)
2 parents e1f24c5 + 25ae98f commit 187f188

8 files changed

+29
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### 0.13.0 -- TBD
44
* Support DataJoint datatype and connection plugins (#715, #729) PR 730, #735
55
* Allow updating specified secondary attributes using `update1` PR #763
6+
* add dj.key_hash reference to dj.hash.key_hash, treat as 'public api'
67

78
### 0.12.8 -- Jan 12, 2021
89
* table.children, .parents, .descendents, and ancestors can return queryable objects. PR #833

datajoint/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'Not', 'AndList', 'U', 'Diagram', 'Di', 'ERD',
2525
'set_password', 'kill',
2626
'MatCell', 'MatStruct', 'AttributeAdapter',
27-
'errors', 'DataJointError', 'key']
27+
'errors', 'DataJointError', 'key', 'key_hash']
2828

2929
from .version import __version__
3030
from .settings import config
@@ -38,6 +38,7 @@
3838
from .admin import set_password, kill
3939
from .blob import MatCell, MatStruct
4040
from .fetch import key
41+
from .hash import key_hash
4142
from .attribute_adapter import AttributeAdapter
4243
from . import errors
4344
from .errors import DataJointError
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
This can be done by using `dj.key_hash` to convert the key as follows:
3+
4+
.. code-block:: python
5+
6+
In [4]: schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}
7+
Out[4]:
8+
*table_name *key_hash status key error_message error_stac user host pid connection_id timestamp
9+
+------------+ +------------+ +--------+ +--------+ +------------+ +--------+ +------------+ +-------+ +--------+ +------------+ +------------+
10+
__job_results c81e728d9d4c2f error =BLOB= KeyboardInterr =BLOB= datajoint@localhost localhost 15571 59 2017-09-04 14:
11+
(Total: 1)
12+
13+
In [5]: (schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}).delete()
14+
15+
In [6]: schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}
16+
Out[6]:
17+
*table_name *key_hash status key error_message error_stac user host pid connection_id timestamp
18+
+------------+ +----------+ +--------+ +--------+ +------------+ +--------+ +------+ +------+ +-----+ +------------+ +-----------+
19+
20+
(Total: 0)
21+

docs-parts/computation/06-distributed-computing_kill_order_by.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
For example, to sort the output by hostname in descending order:
33

4-
.. code-block:: text
4+
.. code-block:: python
55
66
In [3]: dj.kill(None, None, 'host desc')
77
Out[3]:

docs-parts/computation/06-distributed-computing_lang2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
.. code-block:: text
2+
.. code-block:: python
33
44
In [1]: schema.jobs
55
Out[1]:

docs-parts/computation/06-distributed-computing_lang3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
For example, if a Python process is interrupted via the keyboard, a KeyboardError will be logged to the database as follows:
33

4-
.. code-block:: text
4+
.. code-block:: python
55
66
In [2]: schema.jobs
77
Out[2]:

docs-parts/computation/06-distributed-computing_lang4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
For example, given the above table, errors can be inspected as follows:
33

4-
.. code-block:: text
4+
.. code-block:: python
55
66
In [3]: (schema.jobs & 'status="error"' ).fetch(as_dict=True)
77
Out[3]:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
For example:
33

4-
.. code-block:: text
4+
.. code-block:: python
55
66
In [4]: (schema.jobs & 'status="error"' ).delete()

0 commit comments

Comments
 (0)