Skip to content

Commit 77d6fa1

Browse files
committed
Merge branch 'master' of https://github.com/datajoint/datajoint-python into black-formatting
2 parents fee1ca5 + 413e2f9 commit 77d6fa1

File tree

11 files changed

+65
-57
lines changed

11 files changed

+65
-57
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
## Release notes
22

3-
### 0.13.4 -- TBA
3+
### 0.13.4 -- March, 25 2022
44
* Add - Allow reading blobs produced by legacy 32-bit compiled mYm library for matlab. PR #995
5+
* Bugfix - Add missing `jobs` argument for multiprocessing PR #997
6+
* Add - Test for multiprocessing PR #1008
7+
* Bugfix - Fix external store key name doesn't allow '-' (#1005) PR #1006
58

69
### 0.13.3 -- Feb 9, 2022
710
* Bugfix - Fix error in listing ancestors, descendants with part tables.

LNX-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
interval: 1s
3333
fakeservices.datajoint.io:
3434
<<: *net
35-
image: datajoint/nginx:v0.0.19
35+
image: datajoint/nginx:v0.1.1
3636
environment:
3737
- ADD_db_TYPE=DATABASE
3838
- ADD_db_ENDPOINT=db:3306

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
# Welcome to DataJoint for Python!
99
DataJoint for Python is a framework for scientific workflow management based on relational principles. DataJoint is built on the foundation of the relational data model and prescribes a consistent method for organizing, populating, computing, and querying data.
1010

11-
DataJoint was initially developed in 2009 by Dimitri Yatsenko in Andreas Tolias' Lab for the distributed processing and management of large volumes of data streaming from regular experiments. Starting in 2011, DataJoint has been available as an open-source project adopted by other labs and improved through contributions from several developers.
12-
13-
Vathes LLC supports DataJoint for Python as an open-source project and everyone is welcome to contribute.
14-
Its DataJoint Neuro (https://djneuro.io) business provides support to neuroscience labs for developing and executing custom data pipelines.
11+
DataJoint was initially developed in 2009 by Dimitri Yatsenko in Andreas Tolias' Lab at Baylor College of Medicine for the distributed processing and management of large volumes of data streaming from regular experiments. Starting in 2011, DataJoint has been available as an open-source project adopted by other labs and improved through contributions from several developers.
12+
Presently, the primary developer of DataJoint open-source software is the company DataJoint (https://datajoint.com). Related resources are listed at https://datajoint.org
1513

1614
## Installation
1715
```
@@ -22,7 +20,18 @@ If you already have an older version of DataJoint installed using `pip`, upgrade
2220
```bash
2321
pip3 install --upgrade datajoint
2422
```
23+
24+
## Documentation and Tutorials
25+
26+
* https://datajoint.org -- start page
27+
* https://docs.datajoint.org -- up-to-date documentation
28+
* https://tutorials.datajoint.io -- step-by-step tutorials
29+
* https://elements.datajoint.org -- catalog of example pipelines
30+
* https://codebook.datajoint.io -- interactive online tutorials
31+
2532
## Python Native Blobs
33+
<details>
34+
<summary>Click to expand details</summary>
2635

2736
DataJoint 0.12 adds full support for all native python data types in blobs: tuples, lists, sets, dicts, strings, bytes, `None`, and all their recursive combinations.
2837
The new blobs are a superset of the old functionality and are fully backward compatible.
@@ -92,16 +101,11 @@ the situation, but generally the following strategies may apply:
92101
As always, be sure that your data is safely backed up before modifying any
93102
important DataJoint schema or records.
94103

95-
## Documentation and Tutorials
96-
A number of labs are currently adopting DataJoint and we are quickly getting the documentation in shape in February 2017.
97-
98-
* https://datajoint.io -- start page
99-
* https://docs.datajoint.io -- up-to-date documentation
100-
* https://tutorials.datajoint.io -- step-by-step tutorials
101-
* https://catalog.datajoint.io -- catalog of example pipelines
104+
</details>
102105

103106
## Running Tests Locally
104-
107+
<details>
108+
<summary>Click to expand details</summary>
105109

106110
* Create an `.env` with desired development environment values e.g.
107111
``` sh
@@ -136,9 +140,9 @@ GID=1000
136140
* Add entry in `/etc/hosts` for `127.0.0.1 fakeservices.datajoint.io`
137141

138142

139-
140-
141143
### Launch Jupyter Notebook for Interactive Use
142144
* Navigate to `localhost:8888`
143145
* Input Jupyter password
144146
* Launch a notebook i.e. `New > Python 3`
147+
148+
</details>

datajoint/autopopulate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ def handler(signum, frame):
233233
# spawn multiple processes
234234
self.connection.close() # disconnect parent process from MySQL server
235235
del self.connection._conn.ctx # SSLContext is not pickleable
236-
with mp.Pool(
237-
processes, _initialize_populate, (self, populate_kwargs)
238-
) as pool:
236+
with mp.Pool(processes, _initialize_populate, (self, jobs, populate_kwargs)) as pool:
239237
if display_progress:
240238
with tqdm(desc="Processes: ", total=nkeys) as pbar:
241239
for error in pool.imap(_call_populate1, keys, chunksize=1):

datajoint/declare.py

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,25 @@
1111

1212
UUID_DATA_TYPE = "binary(16)"
1313
MAX_TABLE_NAME_LENGTH = 64
14-
CONSTANT_LITERALS = {
15-
"CURRENT_TIMESTAMP",
16-
"NULL",
17-
} # SQL literals to be used without quotes (case insensitive)
18-
EXTERNAL_TABLE_ROOT = "~external"
19-
20-
TYPE_PATTERN = {
21-
k: re.compile(v, re.I)
22-
for k, v in dict(
23-
INTEGER=r"((tiny|small|medium|big|)int|integer)(\s*\(.+\))?(\s+unsigned)?(\s+auto_increment)?|serial$",
24-
DECIMAL=r"(decimal|numeric)(\s*\(.+\))?(\s+unsigned)?$",
25-
FLOAT=r"(double|float|real)(\s*\(.+\))?(\s+unsigned)?$",
26-
STRING=r"(var)?char\s*\(.+\)$",
27-
ENUM=r"enum\s*\(.+\)$",
28-
BOOL=r"bool(ean)?$", # aliased to tinyint(1)
29-
TEMPORAL=r"(date|datetime|time|timestamp|year)(\s*\(.+\))?$",
30-
INTERNAL_BLOB=r"(tiny|small|medium|long|)blob$",
31-
EXTERNAL_BLOB=r"blob@(?P<store>[a-z]\w*)$",
32-
INTERNAL_ATTACH=r"attach$",
33-
EXTERNAL_ATTACH=r"attach@(?P<store>[a-z]\w*)$",
34-
FILEPATH=r"filepath@(?P<store>[a-z]\w*)$",
35-
UUID=r"uuid$",
36-
ADAPTED=r"<.+>$",
37-
).items()
38-
}
14+
CONSTANT_LITERALS = {'CURRENT_TIMESTAMP', 'NULL'} # SQL literals to be used without quotes (case insensitive)
15+
EXTERNAL_TABLE_ROOT = '~external'
16+
17+
TYPE_PATTERN = {k: re.compile(v, re.I) for k, v in dict(
18+
INTEGER=r'((tiny|small|medium|big|)int|integer)(\s*\(.+\))?(\s+unsigned)?(\s+auto_increment)?|serial$',
19+
DECIMAL=r'(decimal|numeric)(\s*\(.+\))?(\s+unsigned)?$',
20+
FLOAT=r'(double|float|real)(\s*\(.+\))?(\s+unsigned)?$',
21+
STRING=r'(var)?char\s*\(.+\)$',
22+
ENUM=r'enum\s*\(.+\)$',
23+
BOOL=r'bool(ean)?$', # aliased to tinyint(1)
24+
TEMPORAL=r'(date|datetime|time|timestamp|year)(\s*\(.+\))?$',
25+
INTERNAL_BLOB=r'(tiny|small|medium|long|)blob$',
26+
EXTERNAL_BLOB=r'blob@(?P<store>[a-z][\-\w]*)$',
27+
INTERNAL_ATTACH=r'attach$',
28+
EXTERNAL_ATTACH=r'attach@(?P<store>[a-z][\-\w]*)$',
29+
FILEPATH=r'filepath@(?P<store>[a-z][\-\w]*)$',
30+
UUID=r'uuid$',
31+
ADAPTED=r'<.+>$'
32+
).items()}
3933

4034
# custom types are stored in attribute comment
4135
SPECIAL_TYPES = {

docs-parts/intro/Releases_lang1.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
0.13.4 -- TBA
1+
0.13.4 -- March 25, 2022
22
----------------------
33
* Add - Allow reading blobs produced by legacy 32-bit compiled mYm library for matlab. PR #995
4+
* Bugfix - Add missing ``jobs`` argument for multiprocessing PR #997
5+
* Add - Test for multiprocessing PR #1008
6+
* Bugfix - Fix external store key name doesn't allow '-' (#1005) PR #1006
47

58
0.13.3 -- Feb 9, 2022
69
----------------------

local-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
interval: 1s
3535
fakeservices.datajoint.io:
3636
<<: *net
37-
image: datajoint/nginx:v0.0.19
37+
image: datajoint/nginx:v0.1.1
3838
environment:
3939
- ADD_db_TYPE=DATABASE
4040
- ADD_db_ENDPOINT=db:3306

tests/schema_adapted.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from . import PREFIX, CONN_INFO, S3_CONN_INFO
99

1010
stores_config = {
11-
'repo_s3': dict(
11+
'repo-s3': dict(
1212
S3_CONN_INFO,
1313
protocol='s3',
1414
location='adapted/repo',
@@ -59,7 +59,7 @@ class LayoutToFilepath(dj.AttributeAdapter):
5959
An adapted data type that saves a graph layout into fixed filepath
6060
"""
6161

62-
attribute_type = 'filepath@repo_s3'
62+
attribute_type = 'filepath@repo-s3'
6363

6464
@staticmethod
6565
def get(path):
@@ -68,7 +68,7 @@ def get(path):
6868

6969
@staticmethod
7070
def put(layout):
71-
path = Path(dj.config['stores']['repo_s3']['stage'], 'layout.json')
71+
path = Path(dj.config['stores']['repo-s3']['stage'], 'layout.json')
7272
with open(str(path), "w") as f:
7373
json.dump(layout, f)
7474
return path

tests/schema_external.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
protocol='file',
2323
location=tempfile.mkdtemp()),
2424

25-
'repo_s3': dict(
25+
'repo-s3': dict(
2626
S3_CONN_INFO,
2727
protocol='s3',
2828
location='dj/repo',
@@ -130,7 +130,7 @@ class FilepathS3(dj.Manual):
130130
# table for file management
131131
fnum : int
132132
---
133-
img : filepath@repo_s3 # managed files
133+
img : filepath@repo-s3 # managed files
134134
"""
135135

136136
dj.errors._switch_filepath_types(False)

tests/test_autopopulate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ def test_allow_direct_insert(self):
5757
key['experiment_date'] = '2018-10-30'
5858
self.experiment.insert1(key, allow_direct_insert=True)
5959

60+
def test_multi_processing(self):
61+
assert self.subject, 'root tables are empty'
62+
assert not self.experiment, 'table already filled?'
63+
self.experiment.populate(processes=2)
64+
assert len(self.experiment) == len(self.subject)*self.experiment.fake_experiments_per_subject
65+
6066
@raises(DataJointError)
6167
def test_allow_insert(self):
6268
assert_true(self.subject, 'root tables are empty')

0 commit comments

Comments
 (0)