Skip to content
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

Removed Started at date #1840

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Conversation

pnaik1
Copy link
Contributor

@pnaik1 pnaik1 commented Sep 21, 2023

Closes: #1543

Description

Removed the Started at date from Details tab of pipelineRun
Screenshot from 2023-09-21 16-13-33
When pipelineRuns are immediately triggerred the finished at first has N/A value later after completion of runs it gets it exact value

Screencast.from.2023-09-21.17-12-08.webm

How Has This Been Tested?

  1. Check whether the Started at date is not present in the detail tab of pipelineRun
  2. When creating a new piplineRun the finished at displays N/A instead of epoch value and later on gets the exact value

Test Impact

N/A

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Commits have been squashed into descriptive, self-contained units of work (e.g. 'WIP' and 'Implements feedback' style messages have been removed)
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit tests & storybook for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change (find relevant UX in the SMEs section).

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@lucferbux
Copy link
Contributor

To add some context, I suggested @pnaik1 not adding testing for this PR, it can only be covered with integration/component testing, and we don't have anything in place for pipelines yet.

@pnaik1
Copy link
Contributor Author

pnaik1 commented Sep 21, 2023

the test for this pr should be covered with integration testing of pipelines, but it’s not already in place

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

Works fine.

I think Started at was there for scheduled runs, but Created at and Started at were too close(8 seconds apart in the screenshot below). Correct me if I'm wrong. Is that why we chose to remove Started at altogether?

Screenshot 2023-09-21 at 6 29 16 PM

This screenshot is of a scheduled run(Run every minute). - what happens when we run every hour/every day? That's when the Started at and Created at may differ widely maybe.

Edit: Sorry I wanted to start a conversation, but clicked on "Request changes" instead.

@lucferbux
Copy link
Contributor

Yes @manaswinidas you can check the whole conversation in the issue, but the main take with the outcome is summarized here: #1543 (comment)

We are removing Started at (scheduled at) cause it was too close to the other values.

Copy link
Member

@DaoDaoNoCode DaoDaoNoCode left a comment

Choose a reason for hiding this comment

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

/lgtm
Tested, works well.

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

/lgtm

Tested. Works fine.

@openshift-ci openshift-ci bot removed the lgtm label Sep 28, 2023
@alexcreasy alexcreasy added the pr/no-tests-allowed Added by an official approver - this PR is allowed no tests. Omitted, a test must accompany the PR label Sep 28, 2023
value: asTimestamp(new Date(pipelineRunKF.scheduled_at || pipelineRunKF.created_at)),
key: 'Finished at',
value:
pipelineRunKF.finished_at === '1970-01-01T00:00:00Z'
Copy link
Contributor

Choose a reason for hiding this comment

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

Define a new constant and use it here: const epoch = new Date(0).toISOString();

Suggested change
pipelineRunKF.finished_at === '1970-01-01T00:00:00Z'
pipelineRunKF.finished_at === epoch

@@ -24,7 +24,7 @@ const PipelineRunTabDetails: React.FC<PipelineRunTabDetailsProps> = ({
workflowName,
}) => {
const { namespace, project } = usePipelinesAPI();

const epoch = new Date(0).toISOString().slice(0, -5) + 'Z';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry @pnaik1, My eyes deceived me when I compared your original string constant to the output of new Date(0).toISOString()! I didn't realize that the string values differed in the number of 0's ever so slightly. They still represent the same time however. Go back to using the string value you originally had: 1970-01-01T00:00:00Z.

The comment about creating a constant is to make it available for others in case they need to deal with this same use case in the future. Create the constant in concepts/pipelines/const.ts. Also, you can add a comment as to why this value exist. eg. A pipeline run that has not yet finished will have this value set as its 'finished_at' timestamp.
Let's also change the constant name to be more representative of how it's used by pipelines: INVALID_TIMESTAMP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@christianvogt no worries , just to clarify or summarize the things , now I need to create a string constant value
(const INVALID_TIMESTAMP=1970-01-01T00:00:00Z)
in concepts/pipelines/const.ts ? and add the comments

Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we can't just write a utility to say isEmptyDateKF(resourceKF.finished_at) and it would just isolate this logic? I find it will be more pragmatic if we just lock away this logic away and stop writing inline functionality. Make it a common utility for all of the DS Pipelines effort.

The implementation of this method can be comparing a static string or doing proper date conversions, it doesn't matter either way as it just needs to get the job done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two solution under consideration

  1. Using the constant
  2. Implementing the utility function
    @andrewballantyne @christianvogt which one do I need to go with?

Copy link
Member

Choose a reason for hiding this comment

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

Write a utility, use a constant or whatever you want inside it... stop making custom logic comparisons... if we can't use OOTB ISO format, don't write special code to do it. It's a kubeflow concept, write a utility for it.

a === b doesn't need to be anything more than a comparison... isoFormat.split.doOtherThing === b is now custom logic that you should not ever rewrite, so put it into a utility.

DRY with some intentional effort here not to make a need to refactor.

@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Nov 1, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, DaoDaoNoCode, manaswinidas

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved label Nov 1, 2023
@openshift-ci openshift-ci bot merged commit 7995cc7 into opendatahub-io:main Nov 1, 2023
3 checks passed
@pnaik1 pnaik1 deleted the issue-1543 branch July 22, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm pr/no-tests-allowed Added by an official approver - this PR is allowed no tests. Omitted, a test must accompany the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Pipelines "started at" and "finished at" dates look strange.
7 participants