[ 
https://issues.apache.org/jira/browse/AURORA-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16358591#comment-16358591
 ] 

Stephan Erb commented on AURORA-1971:
-------------------------------------

What you are observing is the behaviour described here 
[https://github.com/apache/aurora/blob/master/docs/reference/configuration-templating.md#mustaches-within-structurals].
  

You cannot see the name of the job as it is shadowed by the name of the process 
(see [https://github.com/wickman/pystachio#object-scopes] for details on 
scoping). A possible workaround could be to define a custom pystachio variable 
and use it in both places:
{code:java}
hello = Process(
  name='my_process_name',
  cmdline="""
    while true; do
      echo {{job_name}}
      sleep 10
    done
  """)

task = SequentialTask(
  processes=[hello],
  resources=Resources(cpu = 1.0, ram = 128*MB, disk = 128*MB))

jobs = [
   Service(
      task=task,
      cluster='devcluster',
      role = 'www-data',
      environment = 'prod',
      name = '{{job_name}}'
   ).bind(job_name='hello')
]
{code}



> Access to the job name in aurora configuration?
> -----------------------------------------------
>
>                 Key: AURORA-1971
>                 URL: https://issues.apache.org/jira/browse/AURORA-1971
>             Project: Aurora
>          Issue Type: Story
>            Reporter: Allan Feid
>            Priority: Minor
>
> I see there's a few different variables exposed in the pystachio 
> configurations (environment, role, task.name, mesos), however I have not been 
> able to figure out how to extract the job name. It seems a job's name 
> defaults to task.name but in my case these are not the same. The use case for 
> this is to simply export environment variables that give running processes 
> access to their environment, role, and job names.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to