Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 0.13.0 -- TBD
* Support DataJoint datatype and connection plugins (#715, #729) PR 730, #735
* Allow updating specified secondary attributes using `update1` PR #763
* add dj.key_hash reference to dj.hash.key_hash, treat as 'public api'

### 0.12.8 -- Jan 12, 2021
* table.children, .parents, .descendents, and ancestors can return queryable objects. PR #833
Expand Down
3 changes: 2 additions & 1 deletion datajoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'Not', 'AndList', 'U', 'Diagram', 'Di', 'ERD',
'set_password', 'kill',
'MatCell', 'MatStruct', 'AttributeAdapter',
'errors', 'DataJointError', 'key']
'errors', 'DataJointError', 'key', 'key_hash']

from .version import __version__
from .settings import config
Expand All @@ -38,6 +38,7 @@
from .admin import set_password, kill
from .blob import MatCell, MatStruct
from .fetch import key
from .hash import key_hash
from .attribute_adapter import AttributeAdapter
from . import errors
from .errors import DataJointError
Expand Down
21 changes: 21 additions & 0 deletions docs-parts/computation/06-distributed-computing_jobs_by_key.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

This can be done by using `dj.key_hash` to convert the key as follows:

.. code-block:: python

In [4]: schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}
Out[4]:
*table_name *key_hash status key error_message error_stac user host pid connection_id timestamp
+------------+ +------------+ +--------+ +--------+ +------------+ +--------+ +------------+ +-------+ +--------+ +------------+ +------------+
__job_results c81e728d9d4c2f error =BLOB= KeyboardInterr =BLOB= datajoint@localhost localhost 15571 59 2017-09-04 14:
(Total: 1)

In [5]: (schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}).delete()

In [6]: schema.jobs & {'key_hash' : dj.key_hash({'id': 2})}
Out[6]:
*table_name *key_hash status key error_message error_stac user host pid connection_id timestamp
+------------+ +----------+ +--------+ +--------+ +------------+ +--------+ +------+ +------+ +-----+ +------------+ +-----------+

(Total: 0)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

.. code-block:: text
.. code-block:: python

In [3]: dj.kill(None, None, 'host desc')
Out[3]:
Expand Down
2 changes: 1 addition & 1 deletion docs-parts/computation/06-distributed-computing_lang2.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.. code-block:: text
.. code-block:: python

In [1]: schema.jobs
Out[1]:
Expand Down
2 changes: 1 addition & 1 deletion docs-parts/computation/06-distributed-computing_lang3.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

.. code-block:: text
.. code-block:: python

In [2]: schema.jobs
Out[2]:
Expand Down
2 changes: 1 addition & 1 deletion docs-parts/computation/06-distributed-computing_lang4.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

.. code-block:: text
.. code-block:: python

In [3]: (schema.jobs & 'status="error"' ).fetch(as_dict=True)
Out[3]:
Expand Down
2 changes: 1 addition & 1 deletion docs-parts/computation/06-distributed-computing_lang5.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

For example:

.. code-block:: text
.. code-block:: python

In [4]: (schema.jobs & 'status="error"' ).delete()