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

refactor kubernetes providers: each block in kube refers to a pod #1073

Merged
merged 9 commits into from
Jun 19, 2019

Conversation

ZhuozhaoLi
Copy link
Contributor

fix #853.

Now kubernetes provider creates non-deployment pods for each executor, rather than deployments.
The scaling of pods will be managed by Parsl.

Refer the details to the discussions in #853

@@ -65,7 +65,7 @@ def __init__(self,
max_blocks=10,
parallelism=1,
worker_init="",
deployment_name=None,
pod_name=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

needs docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -161,9 +159,10 @@ def cancel(self, job_ids):
for job in job_ids:
logger.debug("Terminating job/proc_id: {0}".format(job))
# Here we are assuming that for local, the job_ids are the process id's
self._delete_deployment(job)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe remove _delete_deployment from the source file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

formatted_cmd = template_string.format(command=cmd_string,
worker_init=self.worker_init)

self.deployment_obj = self._create_deployment_object(job_name,
Copy link
Collaborator

Choose a reason for hiding this comment

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

_create_deployment and _create_deployment_object are dead code that should be removed maybe now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

port=80,
cmd_string=None,
volumes=[]):
""" Create a kubernetes non-deployment pod for the job.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Refer to this as this a "pod", not a "non-deployment pod".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

for volume in volumes:
volume_mounts.append(client.V1VolumeMount(mount_path=volume[1],
name=volume[0]))
# Configureate Pod template container
Copy link
Collaborator

Choose a reason for hiding this comment

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

"configure"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

name=volume[0]))
# Configureate Pod template container
container = None
if security_context:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the only purpose of this is to supply or not supply the security_context parameter. It looks (from the generated python code of V1Container in https://github.com/kubernetes-client/python/blob/master/kubernetes/client/models/v1_container.py) that it is fine to pass in None for security_context and so this if-statement could collapse into a single code path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

collapsed

@benclifford
Copy link
Collaborator

This looks ok but I'd like someone to confirm they've definitely run this code and seen it scale correctly.

@ZhuozhaoLi
Copy link
Contributor Author

This looks ok but I'd like someone to confirm they've definitely run this code and seen it scale correctly.

@benclifford I have tested this on petrelkube with DLHub. This includes the following tests.

  1. Pods terminated when the main parsl process exits
  2. Pods terminated when there is no task
  3. Pods scaled out after termination when there are tasks

@benclifford benclifford self-requested a review June 19, 2019 12:20
@benclifford benclifford merged commit 45ec82a into master Jun 19, 2019
@benclifford benclifford deleted the fix_kube_provider_#853 branch June 19, 2019 14:38
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.

scale out mechanism in HTEX not compatible with kubernetes provider
2 participants