Skip to content

Commit 770b015

Browse files
author
Chris Turner
authored
Merge pull request #72 from ttngu207/master
improve report store logging
2 parents 8a310e9 + 4d65fce commit 770b015

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

pipeline/report.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@
2929
os.environ['DJ_SUPPORT_FILEPATH_MANAGEMENT'] = "TRUE"
3030
dj.config['safemode'] = False
3131

32-
store_directory = pathlib.Path(dj.config['stores']['report_store']['stage'])
32+
store_stage = pathlib.Path(dj.config['stores']['report_store']['stage'])
33+
34+
if dj.config['stores']['report_store']['protocol'] == 's3':
35+
store_location = (pathlib.Path(dj.config['stores']['report_store']['bucket'])
36+
/ pathlib.Path(dj.config['stores']['report_store']['location']))
37+
store_location = 'S3: ' + str(store_location)
38+
else:
39+
store_location = pathlib.Path(dj.config['stores']['report_store']['location'])
3340

3441
mpl.rcParams['font.size'] = 16
3542

@@ -49,7 +56,7 @@ class SessionLevelReport(dj.Computed):
4956

5057
def make(self, key):
5158
water_res_num, sess_date = get_wr_sessdate(key)
52-
sess_dir = store_directory / water_res_num / sess_date
59+
sess_dir = store_stage / water_res_num / sess_date
5360
sess_dir.mkdir(parents=True, exist_ok=True)
5461

5562
# ---- behavior_performance ----
@@ -106,7 +113,7 @@ def key_source(self):
106113

107114
def make(self, key):
108115
water_res_num, sess_date = get_wr_sessdate(key)
109-
sess_dir = store_directory / water_res_num / sess_date
116+
sess_dir = store_stage / water_res_num / sess_date
110117
sess_dir.mkdir(parents=True, exist_ok=True)
111118

112119
# ---- Setup ----
@@ -233,7 +240,7 @@ def key_source(self):
233240

234241
def make(self, key):
235242
water_res_num, sess_date = get_wr_sessdate(key)
236-
sess_dir = store_directory / water_res_num / sess_date
243+
sess_dir = store_stage / water_res_num / sess_date
237244
sess_dir.mkdir(parents=True, exist_ok=True)
238245

239246
fig1 = plt.figure(figsize=(16, 12))
@@ -282,7 +289,7 @@ def key_source(self):
282289

283290
def make(self, key):
284291
water_res_num, sess_date = get_wr_sessdate(key)
285-
sess_dir = store_directory / water_res_num / sess_date / str(key['insertion_number'])
292+
sess_dir = store_stage / water_res_num / sess_date / str(key['insertion_number'])
286293
sess_dir.mkdir(parents=True, exist_ok=True)
287294

288295
probe_insertion = ephys.ProbeInsertion & key
@@ -351,7 +358,7 @@ def key_source(self):
351358

352359
def make(self, key):
353360
water_res_num, sess_date = get_wr_sessdate(key)
354-
sess_dir = store_directory / water_res_num / sess_date / str(key['insertion_number'])
361+
sess_dir = store_stage / water_res_num / sess_date / str(key['insertion_number'])
355362
sess_dir.mkdir(parents=True, exist_ok=True)
356363

357364
probe_insertion = ephys.ProbeInsertion & key
@@ -402,7 +409,7 @@ class UnitLevelReport(dj.Computed):
402409

403410
def make(self, key):
404411
water_res_num, sess_date = get_wr_sessdate(key)
405-
sess_dir = store_directory / water_res_num / sess_date / str(key['insertion_number']) / 'units'
412+
sess_dir = store_stage / water_res_num / sess_date / str(key['insertion_number']) / 'units'
406413
sess_dir.mkdir(parents=True, exist_ok=True)
407414

408415
fig1 = unit_psth.plot_unit_psth(key)
@@ -452,7 +459,7 @@ class ProjectLevelProbeTrack(dj.Computed):
452459
key_source = experiment.Project & 'project_name = "MAP"'
453460

454461
def make(self, key):
455-
proj_dir = store_directory
462+
proj_dir = store_stage
456463

457464
session_count = len(SessionLevelProbeTrack())
458465

pipeline/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def generate_report(populate_settings={'reserve_jobs': True, 'display_progress':
113113
def sync_report():
114114
from pipeline import report
115115
for report_tbl in report.report_tables:
116-
log.info(f'Sync: {report_tbl.full_table_name} - From {report.store_directory}')
116+
log.info(f'Sync: {report_tbl.full_table_name} - From {report.store_location} - To {report.store_stage}')
117117
report_tbl.fetch()
118118

119119

0 commit comments

Comments
 (0)