[ckan-dev] Virtualenv tips: how to reload the ini file

Jason Tan jason.tan at ersa.edu.au
Fri Jun 13 03:00:17 UTC 2014


HI John,

Sorry sent that last email accidently prematurely.

I'm not 100% sure what you're trying to do here, but if you want an
existing running paster instance to reload it's config file you could *try*:
kill -HUP <paster_process_id>

E.g. kill -HUP 4506

That sends a hangup signal to the process identified by <paster_process_id>
.
Most unix daemons will re-read and reload their config when they receive a
SIGHUP.
I'm not sure if python/paster respond this was, but it is probably worth a
try - if that is what you are trying to do.

As to being able to join and run an existing session - you could run paster
in a screen session.
screen is a utility that allows you to run a command, log out of your
session and have the command continue exiting.
Later on you can return to the session.

I don't think this is really the right answer, but you could try it until
the right answer presents itself.

To run screen (assuming it is installed on your server) putty into your
server as normal.
At the point you want to run the paster server type:
screen

That effectively open up another terminal session.
However this terminal session is magic as you can leave it running when you
disconnect your putty session.
run your commands
then type
ctrl-a d
I.e. 'ctrl-a' followed by a 'd'
That will log you out of the screen session, however the screen session and
the commands executing in it will keep executing.
You can if you want then log out of putty.

Later on you can log back into the server and run
screen -ls
that should list all the screen sessions that are running for your user but
detached from a terminal. E.g.
[root at kirby ~]# screen
[detached]
[root at kirby ~]# screen -ls
There is a screen on:
        4472.pts-2.kirby        (Detached)
1 Socket in /var/run/screen/S-root.

Then type:
screen -r <session>
The -r is for "re-attach". e.g.
screen -r  4472.pts-2.kirby

That will take you back into the screen session 4472.pts-2.kirby (you can
run more than one screen session) and you can continue where you left off.
When you actually want to exit and finish the screen session re-attach to
it then type
ctrl-d

Hope this helps a bit - or at least until you can get better solutions.

Regards
Jason


On 13 June 2014 12:23, Jason Tan <jason.tan at ersa.edu.au> wrote:

> HI John,
>
> I'm not 100% sure what you're trying to do here, but if you want an
> existing running paster instance to reload it's config file you could
> *try*:
> kill -HUP <paster_process_id>
>
> That sends a hangup signal to the prociess identified by
> <paster_process_id> .
> Most unix daemons will re-read and reload their config when they receive a
> SIGHUP.
> I'm not sure about python/paster, but it is probably worth a try - if that
> is what you are trying to do.
>
> As to being able to join and run an existing session - you could run
> paster in a screen session.
> screen is a utility that allows you to run a command, log out of your
> session and have the command continue exiting.
> Later on you can return to the session.
>
> I don't think this is really the right answer, but you could try it until
> the right answer presents itself.
>
> To run screen (assuming it is installed on your server) putty into your
> server as normal.
> At the point you want to run the paster server type:
> screen
>
> run your commands
> then type
> ctrl-a d
> That will log you out of the screen session, however the screen session
> and the commands exectuing in it will keep executing.
> You can if you want then log out of putty.
>
> Later on you can log back into the server and run
> screen -ls
> E.g.
> that should list all the screen sessions that are running for your user.
> Then type:
> screen -r <session>
>
>
>
>
> Jason
>
>
>
> On 12 June 2014 14:31, John Brisbin <john at boab.info> wrote:
>
>> G'Day all,
>>
>> Thanks to some kindly orientation help from Jason Tan, I have managed to
>> get python to reload the development.ini file and proceed onward on the
>> path to creating a custom theme....but not without some lingering confusion.
>>
>> This is a request for advice on how to manage the virtualenv sessions
>> properly.
>>
>> Starting from a fresh PuTTY login, I run $ netstat -lntp and can see that
>> there's an existing Python process on a given PID (let's say 4506)
>>
>> (1) If I open another shell, activate a virtualenv (.
>> /usr/lib/ckan/default/bin/activate), and try to run the paster command:
>>
>> paster serve --reload /etc/ckan/default/development.ini
>>
>> we will get the message that the server is starting in some other socket
>> (eg 5304), and then will get the socket Errno 98 Address already in use.
>>
>> (2) If I kill the python process manually, and then re-run the paster
>> command, the server appears to reload the ini file and start itself
>> normally.
>>
>> It doesn't seem right that I have to manually kill Python before being
>> able to run the --reload, but, given that Python should always be running,
>> and I don't know how to join (or leave) an existing virtualenv session, I'm
>> not sure what else to do.
>>
>> Thanks for any pointers!
>>
>> Kind regards,
>>
>> JB
>>
>>
>>
>> --
>> John Brisbin
>> Managing Director, BoaB interactive Pty Ltd
>> POB 248, MT Molloy QLD 4871
>>
>> E: john at boab.info
>> M: 0407 471 565 | P: 07 4094 2172
>> Skype: boabjohn | Twitter: @boabjohn
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>
>
>
> --
> Jason Tan
> Data Infrastructure Specialist, eResearch SA
>
> phone: +61 8 8313 2184
> Mob: +61 407 268 270
> email: jason.tan at ersa.edu.au
> web: http://www.ersa.edu.au
>



-- 
Jason Tan
Data Infrastructure Specialist, eResearch SA

phone: +61 8 8313 2184
Mob: +61 407 268 270
email: jason.tan at ersa.edu.au
web: http://www.ersa.edu.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140613/0450fa97/attachment-0003.html>


More information about the ckan-dev mailing list