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

Python script to set parameters for ksonnet prototypes #769

Merged
merged 2 commits into from May 8, 2018

Conversation

Maerville
Copy link
Contributor

@Maerville Maerville commented May 7, 2018

Closes #322


This change is Reviewable

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

v = r"\g<1>" + value + r"\2"
regexps[param] = (r, v, value)

prototype = open(args.file).read().split("\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use with open()to open a file so that opened files are closed.

if "=" not in pair:
raise Exception("Malformed --values")
param, value = pair.split("=")
r = re.compile(r"([ \t]*" + param + ":+ ?\"?)[^\",]+(\"?,?)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining this.

temp_file = args.file + ".tmp"
open(temp_file, "w").write("\n".join(prototype))
os.rename(temp_file, args.file)
print("Successfully made %d replacements" % replacements)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you define a main() function with all this code and invoke it using:

if __name__ == '__main__':
  main()

@@ -0,0 +1,47 @@
import re
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a docstring to explain what this does with an example?

@ankushagarwal
Copy link
Contributor

/ok-to-test

@googlebot
Copy link

CLAs look good, thanks!

@ankushagarwal
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ankushagarwal

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

@k8s-ci-robot k8s-ci-robot merged commit 18bd43e into kubeflow:master May 8, 2018
@Maerville Maerville deleted the update_parameters branch February 22, 2019 10:43
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
* Added script for updating prototypes' parameters

* Added docstring, comments, with open, main function.
yanniszark pushed a commit to arrikto/kubeflow that referenced this pull request Feb 15, 2021
* feat: Add doc

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* feat: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* feat: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* fix: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* fix: Address comments

Signed-off-by: Ce Gao <gaoce@caicloud.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants