[Webservice] Use leading zeros in usr/Reports folders
Description
Adding leading zeros for runs in the correction reports file path for usr/Reports as mentioned in this issue: https://git.xfel.eu/calibration/pycalibration/-/issues/75
How Has This Been Tested?
Relevant Documents (optional)
Types of changes
- New feature (non-breaking change which adds functionality)
Checklist:
-
configuration (/home/xcal/.config/pycalibration/webservice)for production needs to be updated during the next deployment.
Reviewers
Merge request reports
Activity
added Waiting for review label
assigned to @ahmedk
- Resolved by Karim Ahmed
added 1 commit
- f2b9b8cb - Update the correct place for adding runs for correct and dark
- Resolved by Karim Ahmed
As I understand, it was decided to apply this change retroactively, so we need a migration script to run during the deployment. Do you want to go for that as well?
added 1 commit
- 50d79972 - Update the correct place for adding runs for correct and dark
added 1 commit
- 04b75102 - Update webservice.yaml to have reports_folder for both actions and use it in webservice.py
- Resolved by Karim Ahmed
- Resolved by Thomas Kluyver
changed milestone to %3.11.1
added 1 commit
- 0f84e474 - enable renaming all reports folders for all proposals
removed milestone %3.11.1
Related to !943 (merged)
changed milestone to %3.12.0
mentioned in merge request !943 (merged)
changed milestone to %3.12.1
1 import argparse 2 import os 3 from pathlib import Path 4 5 # Update runs into 4 digits integers e.g. r2 to r0002. 6 7 8 def rename_report_folders_for_instrument(directory_path, really): 9 for folder_name in directory_path.glob("*/*/usr/Reports/*"): 10 if folder_name.name.startswith('r') and folder_name.name[1:].isdigit(): 11 new_folder_name = 'r' + folder_name.name[1:].zfill(4) 12 new_path = folder_name.parent.joinpath(new_folder_name) 13 if really: 14 folder_name.rename(new_path) I think if you have an existing directory, it would put the old directory inside it, like
r0041/r41
.I don't think there's any standard function that will do what we want in a single call - if the destination directory exists, I think we'd have to iterate over the contents of the source directory and move them one by one.
added 331 commits
-
0f84e474...f13b7b5d - 323 commits from branch
master
- a1119a84 - Use leading zeros in usr/Reports folders
- 692355ac - Update the correct place for adding runs for correct and dark
- e363fc48 - Update webservice.yaml to have reports_folder for both actions and use it in webservice.py
- ddae966a - assign the reports_folder separately
- 10d626cd - assign runs separatly
- 711a864d - spelling mistake
- d4cd8ba1 - add new script for renaming report folders
- cb4fd7f5 - enable renaming all reports folders for all proposals
Toggle commit list-
0f84e474...f13b7b5d - 323 commits from branch
added 1 commit
- 0e959ab5 - Add path arg, warn for existing Rep folder, and an extra check
added 1 commit
- a35f27a5 - Add logging, fix old run number length check and move to cycle year instead of 1 cycle
The script was used yesterday to update all
usr/Reports
run folders for all instruments for all cycle years until 2020.Edited by Karim Ahmedmentioned in commit 65b886fa