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: Fix issue with volume mount #194

Merged
merged 10 commits into from May 22, 2021

Conversation

peiniliu
Copy link
Contributor

What changes were proposed in this pull request?

fix Issue #193

Why are the changes needed?

fix Issue #193

Does this PR introduce any user-facing change?

No

How was this patch tested?

volume_test.py

@CLAassistant
Copy link

CLAassistant commented Apr 12, 2021

CLA assistant check
All committers have signed the CLA.

@peiniliu
Copy link
Contributor Author

#193

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

Thanks for submitting the PR. Looks like you are still working on it so I changed it to WIP. Let me know when it's ready for review.

@terrytangyuan terrytangyuan changed the title volume #193 [WIP] Fix issue with volume mount Apr 12, 2021
@peiniliu
Copy link
Contributor Author

Hi,
I think you could start reviewing.
following these examples, I find the volume is usually defined inside the workflow.
volume empty
volume existing
volume pvc

Changes I did in couler,
(1) deleted the automatic volume definition inside container.py
(2) add get_volumeMounts_name function to get the volumeMount name of a container
(3) inside the workflow, check if the volume exists before adding the template.dic. If the volume not exists, add empty_dir

I don't know if it is somehow fits your idea, also if you have any comments on this.

@@ -70,6 +70,12 @@ def __init__(
self.node_selector = node_selector
self.volumes = volumes

def get_volumeMounts_name(self):
Copy link
Member

Choose a reason for hiding this comment

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

Use consistent function names

@@ -158,6 +166,22 @@ def to_dict(self):
"Unsupported signature for cluster spec: %s" % sig
)
ts.append(template_dict)
#check volumes
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some tests to make sure the existing and new use cases are covered?

@@ -201,6 +225,7 @@ def to_dict(self):
else:
d["spec"] = workflow_spec

print(d)
Copy link
Member

Choose a reason for hiding this comment

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

Remove this?

}))

if self.volumes:
print(self.volumes)
Copy link
Member

Choose a reason for hiding this comment

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

Remove?

template["volumes"].append(
{"name": volume_mount.name, "emptyDir": {}}
)
# # Volume
Copy link
Member

Choose a reason for hiding this comment

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

Remove commented code if no longer needed

@@ -0,0 +1,17 @@
import os
Copy link
Member

Choose a reason for hiding this comment

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

This looks like an integration test so perhaps move it to integration tests folder and make sure to test this on CI as well similar to others.

@peiniliu
Copy link
Contributor Author

peiniliu commented May 1, 2021

Hi Terry,

Sorry for the late response, Thanks for your comments!
I have fixed all the comments you provided and also added an integration test. Let me know if more things need to be improved.

Best,
Peini

@terrytangyuan
Copy link
Member

Please address unsolved comments and fix failed CI builds. Thanks.

@peiniliu
Copy link
Contributor Author

Hi Terry,

I have fixed the comments, the unit test from my side passed. CI failed because of the exit code == 1 in my test, which is not happening in my env, maybe I miss some CI configuration in couler?
image

Best,

Peini

@terrytangyuan
Copy link
Member

The sanity check failed https://github.com/couler-proj/couler/runs/2614334892

Please check out the instruction here on how to fix it: https://github.com/couler-proj/couler/blob/master/CONTRIBUTING.md#run-sanity-checks

@@ -51,3 +48,6 @@ spec:
- cowsay
args:
- "{{inputs.parameters.para-consumer-0}}"
volumes:
Copy link
Member

Choose a reason for hiding this comment

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

This change doesn't look correct? It should be part of the template? (similar in other YAML files)

go.sum Outdated
@@ -741,6 +748,10 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd h1:5CtCZbICpIOFdgO940moixOPjc0178IU44m4EjOO5IY=
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what introduced these changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,
I think it because I was trying to run integrated tests locally. But I think my go env(proto3) has some version problems.
I have removed these changes.

],
volume_mounts=[VolumeMount("apppath", "/tmp")],
)
# 3) Add an exit handler that runs when the workflow succeeds.
Copy link
Member

Choose a reason for hiding this comment

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

Simplify this example by removing the exit handler

' vol_found=`mount | grep /tmp` && \
if [[ -n $vol_found ]]; \
then echo "Volume mounted and found"; \
else echo "Not found"; fi '
Copy link
Member

Choose a reason for hiding this comment

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

How do we know if this is correct? Should we be exiting 0 and non-zero here instead of just echo-ing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I removed the handler, and add exit -1 instead of not found.

@terrytangyuan
Copy link
Member

@peiniliu Thanks for fixing the tests. I previous overlooked some of the details and just left some additional (minor) comments. Please take another look.

@terrytangyuan terrytangyuan changed the title [WIP] Fix issue with volume mount fix: Fix issue with volume mount May 20, 2021
Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

Thank you!

@terrytangyuan terrytangyuan merged commit 5c10a2c into couler-proj:master May 22, 2021
@peiniliu peiniliu deleted the containerbug branch May 23, 2021 18:14
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.

container volumeMounts can not mount exsist PVC.
3 participants