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

[KED-763] Fix windows bugs for experiment tracking #809

Merged
merged 11 commits into from
Apr 5, 2022

Conversation

rashidakanchwala
Copy link
Contributor

@rashidakanchwala rashidakanchwala commented Apr 4, 2022

Description

Resolves #809

Development notes

When we were developing experiment tracking BE -- there was a known issues of tests failing on win38 due to an issue with windows path.
This was further realised when our Windows users could not see their experiment tracking data.

This issue has now been fixed -- Win38 tests now pass using 'tmp_path'
I have also tested this build on Windows using CMD and the experiment tracking data shows as expected.

@AntonyMilneQB thank you for all your guidance on this ticket <3

QA notes

To test this on Windows CMD. You will need to do the following :-

pip install -e package
cd demo-project
kedro viz --port=4142

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

@rashidakanchwala rashidakanchwala changed the title [DRAFT] [KED-763] Fix windows bugs for experiment tracking [KED-763] Fix windows bugs for experiment tracking Apr 4, 2022
@rashidakanchwala rashidakanchwala marked this pull request as ready for review April 4, 2022 11:42
Copy link
Member

@merelcht merelcht left a comment

Choose a reason for hiding this comment

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

LGTM! 🙂 Just a minor note. This fix should also be mentioned in the release notes when they're written.

@@ -240,16 +241,21 @@ def get_run_tracking_data(
all_runs = {}
for run_id in run_ids:
run_id = ID(run_id)
file_path = dataset._get_versioned_path(str(run_id))
if Path(file_path).is_file():
dataset._version = DatasetVersion(run_id, None)
Copy link
Member

Choose a reason for hiding this comment

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

What does this line do exactly? Is it to set the load_version to the run_id? I think a short note on what's happening here would be useful for future reference.

Copy link
Contributor

@antonymilne antonymilne left a comment

Choose a reason for hiding this comment

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

Awesome work! So nice to have this fixed and also be able to get those tests cleaned up 🎉 It's always been a slight irritation in the back of my mind that we never figured that out 😅 I'll be able to sleep at night again now.

Just some very minor comments, and please would it also be possible to clean up test_load_latest_tracking_data in the same way?

@@ -21,6 +20,8 @@

import strawberry
from fastapi import APIRouter
from kedro.io.core import Version as DatasetVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
from kedro.io.core import Version as DatasetVersion
from kedro.io.core import Version as DataSetVersion

Is how we normally write it in kedro core. Great idea to alias it in order to distinguish from the kedro-viz Version though 👍

Comment on lines 256 to 258
logger.warning(
"`%s` could not be found", dataset._get_versioned_path(str(run_id))
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor tidy: move load_path definition to before if dataset.exists() and then change this logging to:

Suggested change
logger.warning(
"`%s` could not be found", dataset._get_versioned_path(str(run_id))
)
logger.warning(
"`%s` could not be found", load_path)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AntonyMilneQB -- when i use load_path for the warning. and then I have to write the load_path function also for the tests. is that ok?

def example_multiple_run_tracking_catalog_at_least_one_empty_run(example_run_ids):
def example_multiple_run_tracking_catalog_at_least_one_empty_run(
example_run_ids, tmp_path
):
# Note - filepath is assigned without using tmp_path as it fails on windows build.
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this comment now 🎉

@rashidakanchwala rashidakanchwala merged commit 4dc14f6 into main Apr 5, 2022
@rashidakanchwala rashidakanchwala deleted the ked-763/fix/exp-tracking-win-bug branch April 5, 2022 15:04
@limdauto
Copy link
Collaborator

limdauto commented Apr 5, 2022

Thank you. This is amazing to see fixed.

file_path = dataset._get_versioned_path(str(run_id))
if Path(file_path).is_file():
# Set the load_version to run_id
dataset._version = DataSetVersion(run_id, None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@rashidakanchwala do you mind helping me understand why it fixed the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So removing the if Path(file_path).is_file() fixed it because it was returning false.

The other stuff I just changed because Antony suggested we should use load method instead of directly accessing private function.

I did some debugging around why Path(file_path).is_file is returning false when we use Win CMD. Too long to put it here, so I will share with u on discord.

P.S - miss you on slack

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.

4 participants