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

Add contrib driver for Hashicorp Nomad jobs #3103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abjorkl5
Copy link

Based on the Kubernetes contrib, but different.

Closes #3102

@abjorkl5 abjorkl5 requested review from dlstadther, Tarrasch and a team as code owners August 30, 2021 15:29
Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

Just left a few code comments. Requests for some improved readability.

Also, Github is complaining that this branch isn't up-to-date with master. Could you update it?

Lastly, looks like you've got 1 flake8 complaint

  • ./test/contrib/nomad_test.py:66:5: E265 block comment should start with '# '

region=None, namespace=self.nomad_namespace, token=None)
self.job_uuid = str(uuid.uuid4().hex)
now = datetime.utcnow()
self.uu_name = "%s-%s-%s" % (self.name, now.strftime('%Y%m%d%H%M%S'), self.job_uuid[:16])
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we use newer str.format or f-strings? I find them easier to read than % style interpolation or + concatenation

Copy link
Author

Choose a reason for hiding this comment

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

This part was just copied from the kubernetes plugin

luigi/contrib/nomad.py Outdated Show resolved Hide resolved
Comment on lines 309 to 323
job_json['Job']['Meta'].update(labels)
if self.nomad_namespace is not None:
job_json['Namespace'] = self.nomad_namespace
if "Datacenters" not in job_json["Job"]:
job_json["Job"]["Datacenters"] = ["dc1"]
if "TaskGroups" in job_json["Job"]:
for tg in job_json["Job"]["TaskGroups"]:
if "RestartPolicy" not in tg:
tg["RestartPolicy"] = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are lots of default settings in here. Is there a more explicit way to specify a default job_json with all these various default and then update the nested json with user-defined specifics?

If the code to do that is just as involved with lots of conditionals, don't worry about it. But reading through this, I find it less than easy to interpret what the total of defaults are if i were to not specify various overrides.

Copy link
Author

Choose a reason for hiding this comment

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

I divided it up a bit further, that should hopefully make it more self-explanatory.

It looks a bit complex just because that it respects any user spec, not overriding.

Based on the Kubernetes contrib, but different.
@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions.

@stale stale bot added the wontfix label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for hashicorp nomad as backend
2 participants