Actually you could write your json into a file and pass the file path into
the flag. For example

```
$ cat /tmp/a.json
{"MY_FILEPATH": "/home/john/temp_output/test.csv"}
```

And use `file:///tmp/a.json` as the value of env flag.

On Fri, Jul 1, 2016 at 12:40 AM, Erik Weathers <eweath...@groupon.com>
wrote:

> Heh, fair enough.  I know for the master/agent daemons you can put the
> config values into files, which makes this pretty clean (though
> that probably depends on the OS/init-launcher-daemon you are using).  But
> yeah, when using the CLI you have to be pretty careful.
>
> - Erik
>
> On Thu, Jun 30, 2016 at 9:31 AM, Chris Baker <ch...@galacticfog.com>
> wrote:
>
>> On a side note.... requiring people to put JSON on the command line is a
>> sadistic thing to do.
>>
>> On Thu, Jun 30, 2016 at 12:28 PM Erik Weathers <eweath...@groupon.com>
>> wrote:
>>
>>> +1 I would wrap every string in quotes...  otherwise your shell doesn't
>>> know what you mean.  i.e.,
>>>
>>> How is the shell supposed to know that you want this all to be 1 string
>>> value for the --command parameter?
>>>
>>> --command=/home/john/anaconda3/bin/python /home/john/mesos/error_msg.py
>>> read
>>>
>>> Similarly how is the shell to know that you *don't* want to end this
>>> command and start a new one when you have a bare semicolon?
>>>
>>> --resources=cpus:1;mem:128
>>>
>>> - Erik
>>>
>>> On Thu, Jun 30, 2016 at 9:08 AM, haosdent <haosd...@gmail.com> wrote:
>>>
>>>> I use bash as well. How about
>>>> ```
>>>> mesos-execute --master=cluster.example.com:5050 --name=test-program
>>>> --command="/home/john/anaconda3/bin/python
>>>> /home/john/mesos/error_msg.py read" --resources="cpus:1;mem:128"
>>>> --env='{"MY_FILEPATH": "/home/john/temp_output/test.csv"}'
>>>> ```
>>>>
>>>> On Fri, Jul 1, 2016 at 12:04 AM, June Taylor <j...@umn.edu> wrote:
>>>>
>>>>> hasodent,
>>>>>
>>>>> We've tried your suggestion but it seems like that's not working out:
>>>>>
>>>>> mesos-execute --master=cluster.example.com:5050 --name=test-program
>>>>> --command=/home/john/anaconda3/bin/python /home/john/mesos/error_msg.py
>>>>> read --resources=cpus:1;mem:128 --env='{"MY_FILEPATH":
>>>>> "/home/john/temp_output/test.csv"}'
>>>>>
>>>>> john@cluster:~/mesos$ Failed to load flag 'env': Failed to load value
>>>>> ''{"MY_FILEPATH": "/home/john/temp_output/test.csv"}'': syntax error at
>>>>> line 1 near: '{"MY_FILEPATH": "/home/john/temp_output/test.csv"}'
>>>>>
>>>>>
>>>>> We're using the Bash shell. Is anyone else passing file-paths within
>>>>> their environment variable argument?
>>>>>
>>>>>
>>>>> Thanks,
>>>>> June Taylor
>>>>> System Administrator, Minnesota Population Center
>>>>> University of Minnesota
>>>>>
>>>>> On Wed, Jun 29, 2016 at 8:55 PM, haosdent <haosd...@gmail.com> wrote:
>>>>>
>>>>>> Yes, need add quotes for --env='{"key": "value"}' flag.
>>>>>>
>>>>>> On Thu, Jun 30, 2016 at 4:39 AM, Chris Baker <ch...@galacticfog.com>
>>>>>> wrote:
>>>>>>
>>>>>>> It's your shell:
>>>>>>>
>>>>>>> $ echo {"MY_FILEPATH": "/home/john/temp_output/test.csv"}
>>>>>>> {MY_FILEPATH: /home/john/temp_output/test.csv}
>>>>>>>
>>>>>>> On Wed, Jun 29, 2016 at 4:05 PM June Taylor <j...@umn.edu> wrote:
>>>>>>>
>>>>>>>> hasodent,
>>>>>>>>
>>>>>>>> I admit I don't see much of a difference in your version. Are you
>>>>>>>> saying that Mesos doesn't escape the values, and that our program may 
>>>>>>>> be
>>>>>>>> doing that on the executor end?
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> June Taylor
>>>>>>>> System Administrator, Minnesota Population Center
>>>>>>>> University of Minnesota
>>>>>>>>
>>>>>>>> On Wed, Jun 29, 2016 at 2:02 PM, haosdent <haosd...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi, @Taylor I use
>>>>>>>>>
>>>>>>>>> ```
>>>>>>>>> ./src/mesos-execute --env='{"MY_FILEPATH":
>>>>>>>>> "/home/john/temp_output/test.csv"}' --master="localhost:5050" 
>>>>>>>>> --command=env
>>>>>>>>> --name="test"
>>>>>>>>> ```
>>>>>>>>>
>>>>>>>>> to test in my env. The output looks correct in my side
>>>>>>>>>
>>>>>>>>> ```
>>>>>>>>> ...
>>>>>>>>> MY_FILEPATH=/home/john/temp_output/test.csv
>>>>>>>>>
>>>>>>>>> MESOS_SANDBOX=/tmp/mesos/slaves/fe6123b9-8757-4015-be4b-fda901247fce-S0/frameworks/fe6123b9-8757-4015-be4b-fda901247fce-0000/executors/test/runs/fe818890-2a22-4b2b-aab2-816ed0b631d5
>>>>>>>>> ...
>>>>>>>>> ```
>>>>>>>>>
>>>>>>>>> Not sure if your problem caused by your program
>>>>>>>>>
>>>>>>>>> On Thu, Jun 30, 2016 at 1:58 AM, June Taylor <j...@umn.edu> wrote:
>>>>>>>>>
>>>>>>>>>> Greetings,
>>>>>>>>>>
>>>>>>>>>> We are using mesos-execute and passing an argument that contains
>>>>>>>>>> a Unix filepath, as follows:
>>>>>>>>>>
>>>>>>>>>> *mesos-execute --master=cluster.example.com:5050
>>>>>>>>>> <http://cluster.example.com:5050> --name=test-program
>>>>>>>>>> --command=/home/john/anaconda3/bin/python 
>>>>>>>>>> /home/john/mesos/error_msg.py
>>>>>>>>>> read --resources=cpus:1;mem:128 --env={"MY_FILEPATH":
>>>>>>>>>> "/home/john/temp_output/test.csv"}*
>>>>>>>>>>
>>>>>>>>>> The slashes in the file path are then apparently escaped by
>>>>>>>>>> mesos-execute and therefore fail to be useful once picked up by the
>>>>>>>>>> executor:
>>>>>>>>>>
>>>>>>>>>> *FileNotFoundError: [Errno 2] No such file or directory:
>>>>>>>>>> '"\\/home\\/john\\/temp_output\\/test.csv"'*
>>>>>>>>>>
>>>>>>>>>> *I0629 10:13:13.814870 14025 exec.cpp:390] Executor asked to
>>>>>>>>>> shutdown*
>>>>>>>>>>
>>>>>>>>>> Are other people experiencing this? What is the method to avoid
>>>>>>>>>> it?
>>>>>>>>>> Thanks,
>>>>>>>>>> June Taylor
>>>>>>>>>> System Administrator, Minnesota Population Center
>>>>>>>>>> University of Minnesota
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Best Regards,
>>>>>>>>> Haosdent Huang
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Haosdent Huang
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>> Haosdent Huang
>>>>
>>>
>>>
>


-- 
Best Regards,
Haosdent Huang

Reply via email to