Skip to content

Commit b11b37e

Browse files
committed
Registration test fix - ensure start time updated
1 parent be71131 commit b11b37e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.github/workflows/ibllib_ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
python-version: 3.10
2525
- os: ubuntu-latest
2626
python-version: 3.12
27+
env:
28+
ONE_SAVE_ON_DELETE: false
2729
steps:
2830
- uses: actions/checkout@v2
2931
- name: Set up Python ${{ matrix.python-version }}

ibllib/oneibl/registration.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
from one.registration import RegistrationClient, get_dataset_type
1111
from one.remote.globus import get_local_endpoint_id, get_lab_from_endpoint_id
1212
from one.webclient import AlyxClient, no_cache
13-
from one.converters import ConversionMixin
13+
from one.converters import ConversionMixin, datasets2records
1414
import one.alf.exceptions as alferr
1515
from one.api import ONE
16-
try:
17-
from one.util import datasets2records
18-
except ImportError:
19-
from one.converters import datasets2records
2016
from iblutil.util import ensure_list
2117

2218
import ibllib
@@ -249,13 +245,13 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N
249245
missing = [k for k in required if not session_details[k]]
250246
assert not any(missing), 'missing session information: ' + ', '.join(missing)
251247
task_protocols = task_data = settings = []
252-
json_field = end_time = None
248+
json_field = start_time = end_time = None
253249
users = session_details['users']
254250
n_trials = n_correct_trials = 0
255251
else: # Get session info from task data
256-
collections = ensure_list(collections)
252+
collections = sorted(ensure_list(collections))
257253
# read meta data from the rig for the session from the task settings file
258-
task_data = (raw.load_bpod(ses_path, collection) for collection in sorted(collections))
254+
task_data = (raw.load_bpod(ses_path, collection) for collection in collections)
259255
# Filter collections where settings file was not found
260256
if not (task_data := list(zip(*filter(lambda x: x[0] is not None, task_data)))):
261257
raise ValueError(f'_iblrig_taskSettings.raw.json not found in {ses_path} Abort.')
@@ -342,6 +338,8 @@ def register_session(self, ses_path, file_list=True, projects=None, procedures=N
342338
data['task_protocol'] = '/'.join(task_protocols)
343339
if end_time:
344340
data['end_time'] = self.ensure_ISO8601(end_time)
341+
if start_time:
342+
data['start_time'] = self.ensure_ISO8601(start_time)
345343

346344
session = self.one.alyx.rest('sessions', 'partial_update', id=session_id[0], data=data)
347345
if json_field:

ibllib/tests/test_oneibl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def test_register_chained_session(self):
527527
def tearDown(self) -> None:
528528
self.td.cleanup()
529529
self.one.alyx.rest('revisions', 'delete', id=self.rev['name'])
530-
self.one.alyx.rest('tags', 'delete', id=self.tag['id'])
530+
self.one.alyx.rest('tags', 'delete', id=self.tag['name'])
531531
today_revision = self.one.alyx.rest('revisions', 'list', id=self.today_revision)
532532
today_rev = [rev for rev in today_revision if self.today_revision in rev['name']]
533533
for rev in today_rev:

0 commit comments

Comments
 (0)