Skip to content

getCCDBTimeMachineTimestamp.py: fix http response codes - #2509

Open
ehellbar wants to merge 5 commits into
AliceO2Group:masterfrom
ehellbar:pr2509
Open

ehellbar wants to merge 5 commits into
AliceO2Group:masterfrom
ehellbar:pr2509

Conversation

@ehellbar

@ehellbar ehellbar commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

No description provided.

@ehellbar
ehellbar requested a review from sawenzel as a code owner October 16, 2026 14:20
@github-actions

Copy link
Copy Markdown

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

@ehellbar
ehellbar force-pushed the pr2509 branch 2 times, most recently from c3c0e1f to 7085882 Compare October 19, 2026 12:36

@sawenzel sawenzel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a good step towards https://its.cern.ch/jira/browse/O2-6543. Apart from the small inline points, I would merge it as is, since nothing uses the script in production yet.

One question for the next iteration: the object is keyed by Period and Pass, but the value is estimated from a single run. Do we know that all runs of a pass are reconstructed close enough in time for one value to fit them all? If not, we could key by run, or have each job compare the shared value with its own estimate and warn when a reference object like TPC/Calib/CorrectionMapV2 resolves differently.

Next steps: publish and consume the object from o2dpg_sim_workflow_anchored.py, following MCProdInfo, with ALIEN_JDL_CCDB_CONDITION_NOT_AFTER kept as the override. The certificate and upload helpers could then move to a common module, as your FIXME already suggests.

if check is None or "error" in check:
reason = check["error"] if check else "unknown error"
print(f"[getCCDBTimeMachineTimestamp] CCDB cross-check on {args.ccdb_check_path} skipped: {reason}",
print(f"[getCCDBTimeMachineTimestamp] CCDB cross-check on {ccdb_check_path}/{check["timestamp"]} skipped: {reason}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested double quotes inside an f-string are a SyntaxError before Python 3.12. Could you use check['timestamp'] here and in the two prints below? Note also that check can be None, or an error dict without timestamp, in this branch.

if missing:
parser.error("missing required value(s): " + ", ".join(missing))

get_CCDBTimeMachineTS(args.production_tag, args.year, args.period, args.run, args.passname,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is no longer printed, so TS=$(getCCDBTimeMachineTimestamp.py ...) gets nothing. Could you add print(...) of the returned value here?

user_path = 'Users/' + user[0] + '/' + user
url = f"{base_url}/browse/{user_path}/CCDBTimeMachineTS/{query}"

print(f"[getCCDBTimeMachineTimestamp] Checking if CCDBTimeMachineTS already exists: {url}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go to sys.stderr like the other log lines, so that stdout only carries the value. Same for the "Estimating" print in get_CCDBTimeMachineTS.

print(f"[getCCDBTimeMachineTimestamp] Checking if CCDBTimeMachineTS already exists: {url}")

response = requests.get(url, cert=(cert_path, key_path), verify=False)
if response.status_code != 404:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A 403 or 500 is treated as "found" here. Maybe check for response.status_code == 200?

@ehellbar ehellbar changed the title getCCDBTimeMachineTimestamp.py: add CCDB query and upload functionality getCCDBTimeMachineTimestamp.py: fix http response codes Oct 20, 2026
@ehellbar

Copy link
Copy Markdown
Collaborator Author

@sawenzel thanks for the review. I pushed two more commits which should address your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants