Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot commented May 25, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from Andreiafsousa May 25, 2023 13:22
Comment thread bootstrap/bootstrap.py
cmd = 'rmdir /S /Q "{}"'
else:
cmd = 'rm -r "{}"'
cmd = 'rmdir /S /Q "{}"' if (platform.system() == "Windows") else 'rm -r "{}"'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Helper.delete_dir refactored with the following changes:

Comment thread bootstrap/bootstrap.py
Comment on lines -154 to +151
if '__main__' == __name__:
if __name__ == '__main__':
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 154-154 refactored with the following changes:

ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE CODE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 73-136 refactored with the following changes:


# load the model
print("Loading model from " + model_path)
print(f"Loading model from {model_path}")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

"run_id": run_id,
"experiment_name": exp.name}
tagsValue.update(model_tags)
tagsValue |= model_tags
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function register_aml_model refactored with the following changes:

Comment on lines -418 to +407
pipeline_id_string = "##vso[task.setvariable variable=pipeline_id;isOutput=true]{}".format( # NOQA: E501
published_pipeline.id
)
pipeline_id_string = f"##vso[task.setvariable variable=pipeline_id;isOutput=true]{published_pipeline.id}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function build_batchscore_pipeline refactored with the following changes:

Comment on lines -72 to +73
'Could not find CSV dataset at "%s". If you have bootstrapped your project, you will need to provide a CSV.' # NOQA: E501
% file_name
) # NOQA: E501
f'Could not find CSV dataset at "{file_name}". If you have bootstrapped your project, you will need to provide a CSV.'
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

Comment on lines -46 to +48
name=e.pipeline_name + "_with_R_on_DB",
name=f"{e.pipeline_name}_with_R_on_DB",
description="Model training/retraining pipeline",
version=e.build_id
version=e.build_id,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

raise Exception(
"No pipeline found matching name:{}".format(env.scoring_pipeline_name) # NOQA: E501
)
raise Exception(f"No pipeline found matching name:{env.scoring_pipeline_name}")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_pipeline refactored with the following changes:

This removes the following comments ( why? ):

# NOQA: E501

Comment on lines -61 to +66
accounturl = "https://{}.blob.core.windows.net".format(
env.scoring_datastore_storage_name
accounturl = (
f"https://{env.scoring_datastore_storage_name}.blob.core.windows.net"
)

srcblobname = "azureml/{}/{}_out/parallel_run_step.txt".format(
step_id, env.scoring_datastore_storage_name
)
srcblobname = f"azureml/{step_id}/{env.scoring_datastore_storage_name}_out/parallel_run_step.txt"

srcbloburl = "{}/{}/{}".format(
accounturl, env.scoring_datastore_output_container, srcblobname
srcbloburl = (
f"{accounturl}/{env.scoring_datastore_output_container}/{srcblobname}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function copy_output refactored with the following changes:

Comment on lines -130 to +124
print("Error: {}".format(ex))
print(f"Error: {ex}")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function run_batchscore_pipeline refactored with the following changes:

Comment on lines -41 to +44
if(len(matched_pipes) > 1):
if (len(matched_pipes) > 1):
published_pipeline = None
raise Exception(f"Multiple active pipelines are published for build {e.build_id}.") # NOQA: E501
elif(len(matched_pipes) == 0):
elif not matched_pipes:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

compute_target = workspace.compute_targets[compute_name]
if compute_target and type(compute_target) is AmlCompute:
print("Found existing compute target " + compute_name + " so using it.") # NOQA
print(f"Found existing compute target {compute_name} so using it.")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_compute refactored with the following changes:

This removes the following comments ( why? ):

# NOQA

Comment on lines -53 to +59
print("Package stored at {} with build log {}".format(package.location, package.package_build_log_uri)) # NOQA: E501
print(
f"Package stored at {package.location} with build log {package.package_build_log_uri}"
)

# Save the Image Location for other AzDO jobs after script is complete
if args.output_image_location_file is not None:
print("Writing image location to %s" % args.output_image_location_file)
print(f"Writing image location to {args.output_image_location_file}")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 53-57 refactored with the following changes:

Comment on lines -29 to +32
headers['Authorization'] = 'Bearer ' + service_keys[0]
headers['Authorization'] = f'Bearer {service_keys[0]}'
print("Testing service")
print(". url: %s" % service.scoring_uri)
output = call_web_app(service.scoring_uri, headers)

return output
print(f". url: {service.scoring_uri}")
return call_web_app(service.scoring_uri, headers)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function call_web_service refactored with the following changes:

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.

0 participants