Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

feat(job): substitute Requirements for instance unit jobs #479

Merged
merged 1 commit into from
May 29, 2014

Conversation

jonboulle
Copy link
Contributor

Builds on #475, works towards #303

@@ -103,7 +105,13 @@ func (j *Job) Requirements() map[string][]string {
requirements[key] = make([]string, 0)
}

requirements[key] = value
if inst != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, don't we need to replace certain fields even if it isn't an instance unit?

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, probably. I'll have to think about this further as it means the current untiNameIsInstance approach doesn't make the most sense.

@jonboulle
Copy link
Contributor Author

Not super happy about this. Got any suggestions?

@bcwaldon
Copy link
Contributor

I'm worried about the distinction between a Unit and a NamedUnit. How would you feel about putting the NamedUnit functionality in Unit, while allowing the Job model to continue to own the name in the datastore?

@jonboulle
Copy link
Contributor Author

How about this? (tiny change, but feels cleaner to me)

@bcwaldon
Copy link
Contributor

Yeah, that feels better. I think we can move forward with it for now.

@bcwaldon
Copy link
Contributor

@jonboulle We need docs with this PR.

@jonboulle
Copy link
Contributor Author

How's this?


##### Dynamic requirements

fleet supports several systemd specifiers to allow requirements to be dynamically determined based on a Job's name. This means that the same unit can be used for multiple Jobs and the requirements are dynamically substituted at evaluation time.
Copy link
Contributor

Choose a reason for hiding this comment

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

How about "dynamically substituted when the unit is scheduled"? The words "substituted" and "evaluation" feel like they overlap too much.

@bcwaldon
Copy link
Contributor

@jonboulle Thanks, it looks good. LGTM after we sort out that comment.

@jonboulle
Copy link
Contributor Author

Updated.

@bcwaldon
Copy link
Contributor

@jonboulle squash and merge

This reworks the template/instance logic and adds specifier substitution
when parsing the Requirements for a Job.
Instead of an InstanceUnit, we switch to a UnitNameInfo model which
encapsulates information that can be derived from a unit's Name (namely,
the %n %N %i %p specifiers).

Also includes documentation for end users.
jonboulle added a commit that referenced this pull request May 29, 2014
feat(job): substitute Requirements for instance unit jobs
@jonboulle jonboulle merged commit 4fe2808 into coreos:master May 29, 2014
@jonboulle
Copy link
Contributor Author

onward

@jonboulle jonboulle deleted the template_units2 branch May 29, 2014 21:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants