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

Fix mlctl command line #26

Merged
merged 2 commits into from
Aug 19, 2021
Merged

Fix mlctl command line #26

merged 2 commits into from
Aug 19, 2021

Conversation

clarng
Copy link

@clarng clarng commented Aug 19, 2021

mlctl Pull Request Template Guidelines

Goals of this PR 🎉

Fix mlctl command line that crashes

repo:

% mlctl
Traceback (most recent call last):
File "/Users/clarenceng/opt/miniconda3/envs/mls/bin/mlctl", line 33, in
sys.exit(load_entry_point('mlctl', 'console_scripts', 'mlctl')())
File "/Users/clarenceng/opt/miniconda3/envs/mls/bin/mlctl", line 25, in importlib_load_entry_point
return next(matches).load()
File "/Users/clarenceng/opt/miniconda3/envs/mls/lib/python3.7/site-packages/importlib_metadata/init.py", line 168, in load
module = import_module(match.group('module'))
File "/Users/clarenceng/opt/miniconda3/envs/mls/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/Users/clarenceng/github/clarng/mlctl/mlctl/clis/cli.py", line 4, in
from mlctl.clis.train_cli import train
File "/Users/clarenceng/github/clarng/mlctl/mlctl/clis/train_cli.py", line 5, in
from mlctl.clis.common.utils import determine_infra_plugin_from_job, parse_train_yamls, docker_instructions
File "/Users/clarenceng/github/clarng/mlctl/mlctl/clis/common/utils.py", line 10, in
from mlctl.jobs.MlctlDeployJob import MlctlDeployJob
File "/Users/clarenceng/github/clarng/mlctl/mlctl/jobs/MlctlDeployJob.py", line 2, in
RandomWords().get_random_words()
AttributeError: 'RandomWords' object has no attribute 'get_random_words'

Fix usage of RandomWorlds and also made it consistent between steps

Also went and fix test_init that is currently not passing - dircmp runs filecmp under the hood
test_cli passes now except for one that is broken due to refactoring

Things to check on 🎯

  • My Pull Request code follows the coding standards and styles of the project
  • I have worked on unit tests and reviewed my code to the best of my ability
  • I have used comments to help others understand my code better
  • My changes are not generating new warnings
  • I have added unit tests for both positive and negative test cases
  • All unit tests pass successfully before pushing the PR
  • Overall code coverage and diff code coverage is above the minimum requirement
  • I have made sure all dependent downstream changes impacted by my PR are working

Copy link

@awcchungster awcchungster left a comment

Choose a reason for hiding this comment

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

Minor comments, non-blocker

@@ -1,5 +1,4 @@
from random_words import RandomWords
RandomWords().get_random_words()

Choose a reason for hiding this comment

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

good catch

@@ -13,7 +12,7 @@ def __init__(self, job_type, project, name=None):
self.name = name
else:
# else make a new name randomly
word = RandomWords().random_word('d')
word = RandomWords().random_word()

Choose a reason for hiding this comment

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

Random word('d') was intentional because it picked words that start with d

Copy link
Author

@clarng clarng Aug 19, 2021

Choose a reason for hiding this comment

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

Understood

Not a big fan of using words, if we look at the implementation it loads the random words from a file and it is just a fixed list of words

https://github.com/tomislater/RandomWords/blob/master/random_words/nouns.dat

And the list of words are bigger or smaller depending on which character we choose. The list is largest when we don't enforce a starting character

Generally it is better to stick with random generator based on epoch, which is O(1) in time and memory and no extra disk access, and has much lower chance of collision, which I believe is the reason for going random in the first place

I will suggest we move to something cheaper and have lower chance of collision, and avoid potential bug for customer

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Clarence. Let's revisit before merging it to main.

words = RandomWords().get_random_words()
self.name = f'mlctl-batch-{words[1]}'
word = RandomWords().random_word()
self.name = f'mlctl-batch-{word}'

Choose a reason for hiding this comment

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

Batch jobs aren't working yet FYI. It's on the to do list.

Copy link
Author

Choose a reason for hiding this comment

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

Yup, just making it consistent while at it

@mehtadeepen mehtadeepen merged commit e6493c5 into intuit:develop Aug 19, 2021
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.

None yet

3 participants