-
Notifications
You must be signed in to change notification settings - Fork 1.1k
bootstrap diabetes cleanup #189
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
Changes from all commits
88dad1a
91ab083
15be5a8
dd70b3a
9edfe34
4c160fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,38 +57,6 @@ def deletedir(self): | |
os.system( | ||
'rmdir /S /Q "{}"'.format(os.path.join(self._project_directory, dir))) # NOQA: E501 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rmdir won't work for xplat, probably out of scope for this PR. |
||
|
||
def replaceprojectname(self): | ||
# Replace instances of diabetes_regression within files | ||
dirs = [r".env.example", | ||
r".pipelines\azdo-base-pipeline.yml", | ||
r".pipelines\azdo-pr-build-train.yml", | ||
r".pipelines\diabetes_regression-ci-build-train.yml", | ||
r".pipelines\diabetes_regression-ci-image.yml", | ||
r".pipelines\diabetes_regression-template-get-model-version.yml", # NOQA: E501 | ||
r".pipelines\diabetes_regression-variables.yml", | ||
r"environment_setup\Dockerfile", | ||
r"environment_setup\install_requirements.sh", | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline_with_r_on_dbricks.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline_with_r.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_verify_train_pipeline.py", # NOQA: E501 | ||
r"ml_service\util\create_scoring_image.py", | ||
r"diabetes_regression\azureml_environment.json", | ||
r"diabetes_regression\conda_dependencies.yml", | ||
r"diabetes_regression\evaluate\evaluate_model.py", | ||
r"diabetes_regression\training\test_train.py"] # NOQA: E501 | ||
|
||
for file in dirs: | ||
fin = open(os.path.join(self._project_directory, file), | ||
"rt", encoding="utf8") | ||
data = fin.read() | ||
data = data.replace("diabetes_regression", self.project_name) | ||
fin.close() | ||
fin = open(os.path.join(self._project_directory, file), | ||
"wt", encoding="utf8") | ||
fin.write(data) | ||
fin.close() | ||
|
||
def cleandir(self): | ||
# Clean up directories | ||
dirs = ["data", "experimentation"] | ||
|
@@ -108,6 +76,40 @@ def validateargs(self): | |
raise Exception("Project name should be 3 to 15 chars long") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we're replacing more things, I think our valid set of chars might be reduced. \w and _ are probably it. |
||
|
||
|
||
def replaceprojectname(project_dir, project_name, rename_name): | ||
# Replace instances of rename_name within files with project_name | ||
dirs = [r".env.example", | ||
r".pipelines\azdo-base-pipeline.yml", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. \ won't work for xplat, might be out of scope for this PR. |
||
r".pipelines\azdo-pr-build-train.yml", | ||
r".pipelines\diabetes_regression-ci-build-train.yml", | ||
r".pipelines\diabetes_regression-ci-image.yml", | ||
r".pipelines\diabetes_regression-template-get-model-version.yml", # NOQA: E501 | ||
r".pipelines\diabetes_regression-variables.yml", | ||
r"environment_setup\Dockerfile", | ||
r"environment_setup\install_requirements.sh", | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline_with_r_on_dbricks.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline_with_r.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_build_train_pipeline.py", # NOQA: E501 | ||
r"ml_service\pipelines\diabetes_regression_verify_train_pipeline.py", # NOQA: E501 | ||
r"ml_service\util\create_scoring_image.py", | ||
r"diabetes_regression\azureml_environment.json", | ||
r"diabetes_regression\conda_dependencies.yml", | ||
r"diabetes_regression\evaluate\evaluate_model.py", | ||
r"diabetes_regression\register\register_model.py", | ||
r"diabetes_regression\training\test_train.py"] # NOQA: E501 | ||
|
||
for file in dirs: | ||
fin = open(os.path.join(project_dir, file), | ||
"rt", encoding="utf8") | ||
data = fin.read() | ||
data = data.replace(rename_name, project_name) | ||
fin.close() | ||
fin = open(os.path.join(project_dir, file), | ||
"wt", encoding="utf8") | ||
fin.write(data) | ||
fin.close() | ||
|
||
|
||
def main(args): | ||
parser = argparse.ArgumentParser(description='New Template') | ||
parser.add_argument("--d", type=str, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also stick to the standard of -d or --directory, same for below |
||
|
@@ -122,7 +124,9 @@ def main(args): | |
helper.validateargs() | ||
# helper.clonerepo() | ||
helper.cleandir() | ||
helper.replaceprojectname() | ||
replaceprojectname(project_directory, project_name, | ||
"diabetes_regression") | ||
replaceprojectname(project_directory, project_name, "diabetes") | ||
helper.deletedir() | ||
helper.renamefiles() | ||
helper.renamedir() | ||
|
Uh oh!
There was an error while loading. Please reload this page.