cs: provides env variables that contains the resources requested by the job #714
Conversation
…nd mem) requested by the job
@wyegelwel build is now green, can you please merge? |
scheduler/src/cook/mesos/task.clj
Outdated
@@ -85,6 +85,9 @@ | |||
environment (cond-> (assoc (util/job-ent->env job-ent) | |||
"COOK_JOB_UUID" (-> job-ent :job/uuid str)) | |||
group-uuid (assoc "COOK_JOB_GROUP_UUID" (str group-uuid)) | |||
(:cpus resources) (assoc "COOK_JOB_CPUS" (-> resources :cpus int str)) | |||
(:gpus resources) (assoc "COOK_JOB_GPUS" (-> resources :gpus int str)) | |||
(:mem resources) (assoc "COOK_JOB_MEM_MB" (-> resources :mem int str)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we converting to int
here? :cpus
and :mem
can both be floating point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @dposada, please remove the int before we merge
@wyegelwel ready for another round of review |
Would you mind adding a note to our documentation that these environment variables are set? |
…ronment variables in the faq section
Added documentation in the |
scheduler/docs/faq.md
Outdated
## Does Cook set any environment variables before running a task? | ||
|
||
The following environment variables are set by Cook before running a task: | ||
- COOK_JOB_UUID: represents the UUID of the Job the task belongs to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make "job" lowercase here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
scheduler/docs/faq.md
Outdated
|
||
The following environment variables are set by Cook before running a task: | ||
- COOK_JOB_UUID: represents the UUID of the Job the task belongs to. | ||
- COOK_JOB_GROUP_UUID: represents the UUID of the Group the task belongs to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make "group" lowercase, and maybe change to "job group"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
scheduler/docs/faq.md
Outdated
- COOK_JOB_MEM_MB: represents the amount of `mem` (in megabytes) configured in the Job. It can be a fractional number. | ||
|
||
Any environment variables configured in the Job are also included. | ||
In addition, when running an Instance using the Cook Executor, the executor configurations are passed as environment variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make "instance" lowercase here. It's also not so clear what is meant by "the executor configurations" - is there another area of the docs that we can link to that explains this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made lowercase. Added relative link.
scheduler/docs/faq.md
Outdated
- COOK_JOB_MEM_MB: represents the amount of `mem` (in megabytes) configured in the job. It can be a fractional number. | ||
|
||
Any environment variables configured in the Job are also included. | ||
In addition, when running an instance using the Cook Executor, the [executor configurations](configuration.adoc) are passed as environment variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to link to the executor section within that page, since you have to scroll quite a bit before you get to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
scheduler/docs/faq.md
Outdated
- COOK_JOB_GROUP_UUID: represents the UUID of the job group the task belongs to. | ||
- COOK_JOB_CPUS: represents the amount of `cpus` configured in the job. It can be a fractional number. | ||
- COOK_JOB_GPUS: represents the amount of `gpus` configured in the job. It can be a fractional number. | ||
- COOK_JOB_MEM_MB: represents the amount of `mem` (in megabytes) configured in the job. It can be a fractional number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: maybe we should put the environment variable names in backticks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
6b8a48c
to
8a68484
Compare
Build is green. |
Changes proposed in this PR
Why are we making these changes?