Re: [Toolserver-l] Submitting Python jobs to SGE from cron

2011-01-06 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Russell Blau:
> I was never able to get cronsub to accept arguments to the Python script; 

This seems to work fine for me:

willow% cat test.py
#!/usr/bin/python
#$ -j y
#$ -o $HOME/test.out
import sys
print sys.argv
willow% cronsub test test.py a b c
willow% tail ~/test.out
['/sge62/default/spool/wolfsbane/job_scripts/114704', 'a', 'b', 'c']

I think we fixed cronsub some time ago to allow arguments, both to qsub and the 
script itself.  (Did you ever report this problem to us?)

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk0mEnkACgkQIXd7fCuc5vK6jACaAye7rfEapwJrB5rYLlf2lKZQ
p7gAnjFM/EudjCWo6GrMQKzibfzla2cR
=35y7
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Submitting Python jobs to SGE from cron

2011-01-06 Thread Russell Blau
I was never able to get cronsub to accept arguments to the Python script; 
perhaps I was doing it wrong, but this worked so I stopped worrying about 
it.

- Original Message - 
From: "River Tarnell" 
To: 
Sent: Thursday, January 06, 2011 1:39 PM
Subject: Re: [Toolserver-l] Submitting Python jobs to SGE from cron


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Russell Blau:
>> With these scripts in your home directly, you can then set up a cron job 
>> to
>> run any Python script using the following syntax in your crontab:
>
>>  30  9   *   *   *$HOME/pysub jobname $HOME/path/script.py arg1 arg2
>
> What feature(s) does this provide that cronsub doesn't?
>
> - river.
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (FreeBSD)
>
> iEYEARECAAYFAk0mDFAACgkQIXd7fCuc5vJCaQCeO8xJQypYe6p4y08ijt7/2gl2
> wngAn0CbmLG4nie6bNqPs7EDJYc8clZZ
> =7wHw
> -END PGP SIGNATURE-
>
> ___
> Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
> https://lists.wikimedia.org/mailman/listinfo/toolserver-l
> Posting guidelines for this list: 
> https://wiki.toolserver.org/view/Mailing_list_etiquette
> 


___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Submitting Python jobs to SGE from cron

2011-01-06 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Russell Blau:
> With these scripts in your home directly, you can then set up a cron job to 
> run any Python script using the following syntax in your crontab:
 
>  30  9   *   *   *$HOME/pysub jobname $HOME/path/script.py arg1 arg2

What feature(s) does this provide that cronsub doesn't?

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk0mDFAACgkQIXd7fCuc5vJCaQCeO8xJQypYe6p4y08ijt7/2gl2
wngAn0CbmLG4nie6bNqPs7EDJYc8clZZ
=7wHw
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


[Toolserver-l] Submitting Python jobs to SGE from cron

2011-01-06 Thread Russell Blau
Since a number of users seem to be struggling with the conversion to 
Solaris, I thought I would share the scripts I have been using to start my 
Python bots from Solaris cron using the job server.  If you want to use 
these, be sure to substitute your username for "username" in the last line 
of listing 1, and your python path (if you have one defined) in the third 
line of listing 2.

With these scripts in your home directly, you can then set up a cron job to 
run any Python script using the following syntax in your crontab:

 30  9   *   *   *$HOME/pysub jobname $HOME/path/script.py arg1 arg2

"jobname" is an arbitrary name to be given to the job.  Be sure to include 
$HOME/ in both places; replace /path/ with the path from your home directory 
to the Python script.

I don't know as much about bash as I do about Python, so it is very possible 
someone else can improve on these scripts.  :-)  But feel free to use them 
if they are helpful.

Russ

Listing 1: pysub

 #! /bin/ksh
 # like cronsub, but runs a python script instead of a shell script
 . /sge62/default/common/settings.sh
 [[ $# -ge 1 ]] || {
echo >&2 "usage: $0