Skip to content
Snippets Groups Projects
Commit faabaf37 authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Merge branch 'fix/exclude_dublications' into 'master'

Fix:Exclude dublications in a list of last runs

See merge request detectors/pycalibration!223
parents 35a45115 c52ac830
No related branches found
No related tags found
1 merge request!223Fix:Exclude dublications in a list of last runs
...@@ -170,8 +170,6 @@ class RequestHandler(BaseHTTPRequestHandler): ...@@ -170,8 +170,6 @@ class RequestHandler(BaseHTTPRequestHandler):
files.sort(key=os.path.getmtime, reverse=True) files.sort(key=os.path.getmtime, reverse=True)
file_info = [] file_info = []
for i, file in enumerate(files): for i, file in enumerate(files):
if 'xfel.pdf' in file:
continue
if (len(file_info) % 2) == 0: if (len(file_info) % 2) == 0:
bgcolor = 'EEEEEE' bgcolor = 'EEEEEE'
else: else:
...@@ -337,10 +335,9 @@ class RequestHandler(BaseHTTPRequestHandler): ...@@ -337,10 +335,9 @@ class RequestHandler(BaseHTTPRequestHandler):
pdfs = glob.glob(f"{out_folder}/*.pdf") pdfs = glob.glob(f"{out_folder}/*.pdf")
pdfs += glob.glob(f"{out_folder}/*/*.pdf") pdfs += glob.glob(f"{out_folder}/*/*.pdf")
pdfs.sort()
pdfs = {p.split("/")[-1]: p for p in pdfs} pdfs = {p.split("/")[-1]: p for p in pdfs}
fpdfs = [] fpdfs = []
if "xfel.pdf" in pdfs:
del pdfs["xfel.pdf"]
if len(pdfs): if len(pdfs):
# pdfs = ", ".join(pdfs) # pdfs = ", ".join(pdfs)
for pdf, p in pdfs.items(): for pdf, p in pdfs.items():
...@@ -378,16 +375,15 @@ class RequestHandler(BaseHTTPRequestHandler): ...@@ -378,16 +375,15 @@ class RequestHandler(BaseHTTPRequestHandler):
last_calib[instrument] = [] last_calib[instrument] = []
if len(last_calib[instrument]) > config["server-config"]["n-calib"]: # noqa if len(last_calib[instrument]) > config["server-config"]["n-calib"]: # noqa
continue continue
in_folder = '{}/r{:04d}'.format(in_folder, int(runs[0]))
out_folder = '{}/r{:04d}'.format(out_folder, int(runs[0]))
proposal = in_folder.split('/')[6] proposal = in_folder.split('/')[6]
pdfs = glob.glob(f"{out_folder}/*.pdf") pdfs = glob.glob(f"{out_folder}/*.pdf")
pdfs.sort(key=os.path.getmtime, reverse=True)
pdfs = {p.split("/")[-1]: p for p in pdfs} pdfs = {p.split("/")[-1]: p for p in pdfs}
if "xfel.pdf" in pdfs:
del pdfs["xfel.pdf"]
last_calib[instrument].append([requested[:-4], proposal, runs[0], if [proposal, runs[0]] not in [[x[1], x[2]] for x in
pdfs]) last_calib[instrument]]:
last_calib[instrument].append([requested[:-4],
proposal, runs[0], pdfs])
tmpl = self.templates["last-characterizations"] tmpl = self.templates["last-characterizations"]
last_characterizations_r = Template(tmpl).render(char_runs=last_chars, last_characterizations_r = Template(tmpl).render(char_runs=last_chars,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment