def prepare_dashboardreport_withinitcell(report): import json fn = os.path.join(Dirname.report(report), report.index) d = json.load(open(fn)) for ic in range(len(d['cells'])): d['cells'][ic]['metadata']['init_cell'] = True # Get rid of unnecessray info kernel = d['metadata']['kernelspec'] language = d['metadata']['language_info'] d['metadata'].clear() d['metadata']['kernelspec'] = kernel d['metadata']['language_info'] = language json.dump(d, open(fn, 'w'))
def snapshot_report(report): #create permanent dir dir_source = os.path.join(Dirname.reportprepare(report.creator), report.folder) dir_target = os.path.join(Dirname.report(report), 'latest') _copy_dir(dir_source, dir_target, remove=False) #create tagged dir, if there is any tag if report.tag_name: dir_source = os.path.join(Dirname.reportprepare(report.creator), report.folder) dir_target = Dirname.report_with_tag(report) _copy_dir(dir_source, dir_target, remove=False) dir_reportroot = Dirname.reportroot(report.creator) _grantaccess(report.creator, dir_reportroot, acl='rX')
def garbage_report(report): dir_source = Dirname.report(report) garbage = Filename.report_garbage(report) _archivedir(dir_source, garbage, remove = True)
def snapshot_report(report): dir_source = os.path.join(Dirname.reportprepare(report.creator), report.folder) dir_target = Dirname.report(report) _copy_dir(dir_source, dir_target, remove = False) dir_reportroot = Dirname.reportroot(report.creator) _grantaccess(report.creator, dir_reportroot, acl = 'rX')