> private String serviceName = System.getenv("SERVICE_NAME");
Is it a scala object? If so, it can be initialized before any
properties are set.
What happens if the variable/property is read later at run time?

Regards,
Roman

On Thu, May 20, 2021 at 10:41 PM Milind Vaidya <kava...@gmail.com> wrote:
>
> here are the entries from taskmanager logs
>
> 2021-05-20 13:34:13,739 INFO 
> org.apache.flink.configuration.GlobalConfiguration - Loading configuration 
> property: env.java.opts.taskmanager, 
> "-DSERVICE_NAME=hello-test,-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
> 2021-05-20 13:34:13,740 INFO 
> org.apache.flink.configuration.GlobalConfiguration - Loading configuration 
> property: jobmanager.execution.failover-strategy, region
> 2021-05-20 13:34:13,742 INFO 
> org.apache.flink.configuration.GlobalConfiguration - Loading configuration 
> property: containerized.taskmanager.env.SERVICE_NAME, "hello-test"
> 2021-05-20 13:34:13,743 INFO 
> org.apache.flink.configuration.GlobalConfiguration - Loading configuration 
> property: containerized.master.env.SERVICE_NAME, "hello-test"
>
> But the error still persists
>
>
> On Thu, May 20, 2021 at 1:20 PM Roman Khachatryan <ro...@apache.org> wrote:
>>
>> Thanks, it should work. I've created a ticket to track the issue [1].
>> Could you please specify Flink and Yarn versions you are using?
>>
>> You can also use properties (which don't depend on Yarn integration),
>> for example like this:
>> In flink-conf.yaml: env.java.opts.taskmanager: -DSERVICE_NAME=...
>> In the application: System.getProperty("SERVICE_NAME");
>>
>> Regards,
>> Roman
>>
>> On Thu, May 20, 2021 at 9:50 PM Milind Vaidya <kava...@gmail.com> wrote:
>> >
>> >
>> > Hi Roman,
>> >
>> > I have added following lines to conf/flink-conf.yaml
>> >
>> > containerized.taskmanager.env.SERVICE_NAME: "test_service_name"
>> > containerized.master.env.SERVICE_NAME: "test_service_name"
>> >
>> >
>> >
>> >
>> >
>> > On Thu, May 20, 2021 at 12:30 PM Roman Khachatryan <ro...@apache.org> 
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> Could you please share the relevant parts of your flink-conf.yaml?
>> >>
>> >> Regards,
>> >> Roman
>> >>
>> >> On Thu, May 20, 2021 at 9:13 PM Milind Vaidya <kava...@gmail.com> wrote:
>> >> >
>> >> > Hi
>> >> >
>> >> > Need to forward a few env variables to Job and Task manager.
>> >> > I am running jobs in Yarn cluster
>> >> > I was referring to this : Forwarding
>> >> >
>> >> > I also found Stack Overflow
>> >> >
>> >> > I was able to configure and see the variables in Flink Dashboard
>> >> >
>> >> > But the task manager logs stills says
>> >> >
>> >> > `The system environment variable SERVICE_NAME is missing` as an 
>> >> > exception message.
>> >> >
>> >> > The code trying to fetch it is as follows
>> >> >
>> >> > private String serviceName = System.getenv("SERVICE_NAME");
>> >> >
>> >> > Is the fetched one not the same as set one ? How to set / fetch 
>> >> > environment variables in such case ?
>> >> >

Reply via email to