Comments (17)
What are the main motivations for adding '/bin/sh -c' to the front of commands? I want to make sure I keep them in mind as I brainstorm ideas to propose.
from deimos.
This has to do with the semantics of Mesos's CommandInfo
-- the command.value
field is meant to be interpreted by the shell and is a single string.
Maybe it would work if the options
field were processed in a special way: if //
is present, we take all following arguments and move them to the end of the run
command. They would be treated as strings not subject to shell interpretation in any way (so $TZ
would be treated as the literal string, not expanded to the host's timezone).
from deimos.
@solidsnack oh wow - the functionality has been added already! Thank you very much! I'll give the updated code a shot today. This solution will definitely fulfill my use-case.
from deimos.
Sorry, just realized the branch hasn't been merged yet.
from deimos.
Please do ping us back and let us know how it goes.
from deimos.
@solidsnack it worked great!
I was getting the following error:
Jul 8 13:50:52 vagrant deimos[22122]: deimos.cli() Unhandled failure in launch#012Traceback (most recent call last):#012 File "/home/vagrant/deimos/deimos/__init__.py", line 72, in cli#012 result = deimos.containerizer.stdio(containerizer, *argv[1:])#012 File "/home/vagrant/deimos/deimos/containerizer/__init__.py", line 97, in stdio#012 return method(recordio.read(proto), *args[1:])#012 File "/home/vagrant/deimos/deimos/containerizer/docker.py", line 73, in launch#012 options, trailing_argv = split_on(options, "//")#012 File "/home/vagrant/deimos/deimos/containerizer/docker.py", line 337, in split_on#012 preceding = list(takewhile(lambda _: _ != element, iterable))#012NameError: global name 'takewhile' is not defined
To fix it, I added the following line to the top of deimos/containerizer/docker.py:
from itertools import takewhile, dropwhile
I'm not sure if that is a valid addition to the code base or an environment problem on my end (I know next to nothing about python).
from deimos.
Oops. You did the right thing. Not sure how it got committed this way.
from deimos.
Ok good. This solution definitely works for my use case. Thanks for adding the functionality!
from deimos.
If you make a pull request against https://github.com/mesosphere/deimos/tree/argv-in-options containing the itertools
change I would be happy to merge it in and credit you.
from deimos.
@solidsnack Thanks! PR submitted #33
from deimos.
Awesome! I think this is all set, right? I'm assuming I should close the issue since the use case has been satisfied. Thanks for everything @solidsnack!
For anyone who stumbles upon this with a similar need, my REST call to marathon looks like the following and it works like a charm:
{
"container": {
"image": "docker:///flynn/slugrunner",
"options": ["//", "start", "web"]
},
"id": "ubuntu",
"instances": "1",
"cpus": ".5",
"mem": "512",
"cmd": "",
"env": {
"SLUG_URL": "https://example.com/myappslug.tgz",
"PORT": "8080",
"APPVAR1": "value1",
"APPVAR2": "value2",
"APPVAR3": "value3"
}
}
from deimos.
Can we add this to the formal documentation as well? This is very useful and I'd hate to see this get lost in an issue.
from deimos.
@jplock I added a few lines as a starting point #35
from deimos.
@jschneiderhan With a small change I can merge that. Please see line notes.
from deimos.
Cool. I'll let you guys determine if the documentation requirement is fulfilled and close the issue.
Thanks again!
from deimos.
Thanks for your patch.
from deimos.
hey guys, just come up with a complete different solution to the same issue a day ago. I didn't know you were after the same problem, sorry for not sharing early, I want to share my solution in case someone else find it useful: scrapinghub@63329ac
The main advantage is that it can be used from frameworks that doesn't support the "container" field yet, like Chronos. The only drawback is adding "json" to the equation, but that is fine in my case.
thanks. great work!
from deimos.
Related Issues (20)
- deimos not picking up additional options for the run command from config HOT 1
- TypeError exception during launch HOT 3
- How to map service port to the random port? HOT 6
- Possible to run any docker container? HOT 3
- Status code not being returned by conteinerizer
- Not sure how to login to private registry HOT 15
- Error when trying to start mesos-slave with bad path for containerizer_path HOT 1
- Mesos with Spark trying to download non-existent libmesos/ubuntu:14.04 HOT 21
- Use Deimos for only Marathon HOT 2
- Container info in /cgroups on CentOS 6.5 HOT 4
- -p option doesn't work as documented HOT 1
- Mesos environment variables not set when task_info specified
- More than just docker? HOT 3
- Hooks to run tasks after container launch / shutdown HOT 5
- Container flaps between 'Staging' and 'Running' => can't download a package HOT 4
- Question: How does port pairing work? HOT 1
- Deimos should not override workdir HOT 1
- Customize docker run arguments HOT 2
- Deimos insists on ate least one pull per image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deimos.