Skip to content

Make sure run_id is unique by using miliseconds instead of only seconds #12083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dahorak
Copy link
Contributor

@dahorak dahorak commented May 6, 2025

When the run_id is taken just from seconds timestamp, there is a possibility that two runs will get the same run_id:

This situation breaks the reporting to Report Portal and might cause another issues.
To minimize this risk, we can use miliseconds as run_id.

@dahorak dahorak self-assigned this May 6, 2025
@dahorak dahorak requested a review from a team as a code owner May 6, 2025 13:44
@dahorak dahorak added the team/ecosystem Ecosystem team related issues/PRs label May 6, 2025
logger.debug("Generating run_id from timestamp")
run_id = int(time.time())
logger.debug("Generating run_id from timestamp and random number")
run_id = int(time.time()) * 1000 + random.randint(0, 1000)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
run_id = int(time.time()) * 1000 + random.randint(0, 1000)
run_id = int(time.time() * 1000)

As time.time() returns something like:
1746544165.797612

You can make it quite easy with milliseconds included instead of using random. Then the chance we hit the same millisecond is probably impossible

Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: acceptance
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.19
OCS VERSION: 4.19
tested against branch: master

Job FAILED (installation failed, tests not executed).

@dahorak dahorak changed the title Make sure run_id is unique by adding random number as suffix Make sure run_id is unique by using miliseconds instead of only seconds May 6, 2025
Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

Unknown PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: acceptance
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.19
OCS VERSION: 4.19
tested against branch: master

Job state: ABORTED.

Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: acceptance
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.19
OCS VERSION: 4.19
tested against branch: master

Job FAILED (installation failed, tests not executed).

@dahorak dahorak force-pushed the make-sure-run-id-is-unique-by-adding-random-number branch from 23b3e3f to ba0f27e Compare May 7, 2025 07:18
Copy link

openshift-ci bot commented May 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dahorak, petr-balogh, vavuthu

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@petr-balogh petr-balogh merged commit e77880d into red-hat-storage:master May 7, 2025
6 of 7 checks passed
@petr-balogh
Copy link
Member

/cherry-pick release-4.18

@openshift-cherrypick-robot
Copy link
Collaborator

@petr-balogh: new pull request created: #12089

In response to this:

/cherry-pick release-4.18

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dahorak dahorak deleted the make-sure-run-id-is-unique-by-adding-random-number branch May 7, 2025 08:59
@dahorak
Copy link
Contributor Author

dahorak commented May 7, 2025

/cherry-pick release-4.17

@openshift-cherrypick-robot
Copy link
Collaborator

@dahorak: #12083 failed to apply on top of branch "release-4.17":

Applying: use miliseconds as run_id to make sure it is unique
Using index info to reconstruct a base tree...
A	ocs_ci/utility/framework/fusion_fdf_init.py
M	ocs_ci/utility/framework/initialization.py
Falling back to patching base and 3-way merge...
Auto-merging ocs_ci/utility/framework/initialization.py
CONFLICT (modify/delete): ocs_ci/utility/framework/fusion_fdf_init.py deleted in HEAD and modified in use miliseconds as run_id to make sure it is unique. Version use miliseconds as run_id to make sure it is unique of ocs_ci/utility/framework/fusion_fdf_init.py left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 use miliseconds as run_id to make sure it is unique

In response to this:

/cherry-pick release-4.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

@ocs-ci ocs-ci left a comment

Choose a reason for hiding this comment

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

PR validation

Cluster Name:
Cluster Configuration:
PR Test Suite: acceptance
PR Test Path: tests/
Additional Test Params:
OCP VERSION: 4.19
OCS VERSION: 4.19
tested against branch: master

Job PASSED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm size/XS team/ecosystem Ecosystem team related issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants