[Cialug] Starting two jobs at once

Matthew Nuzum newz at bearfruit.org
Tue Nov 27 16:08:16 CST 2012


Thanks for the reply. One of my goals is to make it easy for new contributors to get started. Right now, they just need a few common development tools. In this case, Make and Python.

Two things have come to mind, but I haven't tried them and I think they're both flawed:

1.
Start a task and background it with &
Start the foreground task and wait until it completes
Kill the background task

The prob is I'm not sure really how to kill a background task once it's in the background

2.
Use tmux or screen
This adds an extra dependency and it also makes using it a little harder for people. For example, some of those I've collaborated with in the past, such as designers, are not very comfortable with the terminal. Ctrl+c to end it is easy, not sure you can do this with tmux/screen.

In the Python world another tool that is used is fabric, but I don't think it ads any flexibility in this regard over make.


On Nov 27, 2012, at 3:38 PM, jim kraai <jimgkraai at gmail.com> wrote:

> node might be a great tool for this
> 
> If I were to write this from scratch, and since you're already using
> python, I'd look into twisted reactor and writing/scheduling resource
> watcherdogs.  i'm sure there's much better terminology, but this is one way
> of doing it all in user space.
> 
> Of course, it's possible I've completely missed the point of the question.
> Apologies if that's the case.
> 
> 
> 
> On Tue, Nov 27, 2012 at 2:35 PM, Matthew Nuzum <newz at bearfruit.org> wrote:
> 
>> Hi, in order to make development on projects easier I often automate
>> common tasks with Makefiles. For example, a common work flow for a Python
>> project is:
>> 
>> git clone project
>> cd project
>> make
>> make run
>> 
>> The makefile will generate a virtualenv, install project dependencies and
>> create initial configuration files. Make run will start a temporary web
>> server and keep it running so that I can work on the code and view the
>> project in my browser.
>> 
>> As it turns out, some of my projects are getting more complex because
>> instead of just launching a web server they might also need to launch more
>> than one process to serve an app.
>> 
>> For example, I might need to run mongodb and the Django development
>> server. I don't care about the output of mongodb, but I would like to see
>> the output of the Django dev server. Or possibly want to run sass and have
>> it watch files, compiling them whenever they change, and also run a nodejs
>> app to serve content. Ideally, when I hit ctrl+c everything shuts down
>> orderly.
>> 
>> Any suggestions on how to keep things simple and run a couple tasks at
>> once?
>> 
>> Here is a simple example of a Makefile I use:
>> 
>> PIP=env/bin/pip
>> MANAGE=env/bin/python ./manage.py
>> 
>> all: build syncdb
>> 
>> syncdb:
>>        $(MANAGE) syncdb --noinput
>>        $(MANAGE) migrate
>> 
>> build:
>>        $(PIP) install -r requirements.txt
>> 
>> run:
>>        $(MANAGE) runserver 0.0.0.0:8000
>> 
>> 
>> --
>> Matthew Nuzum
>> newz2000 on freenode, skype, linkedin and twitter
>> 
>> ♫ You're never fully dressed without a smile! ♫
>> 
>> 
>> 
>> _______________________________________________
>> Cialug mailing list
>> Cialug at cialug.org
>> http://cialug.org/mailman/listinfo/cialug
>> 
>> 
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug

-- 
Matthew Nuzum
newz2000 on freenode, skype, linkedin and twitter

♫ You're never fully dressed without a smile! ♫


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4136 bytes
Desc: not available
URL: <http://cialug.org/pipermail/cialug/attachments/20121127/b9ac643a/attachment.bin>


More information about the Cialug mailing list