[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] HTCondor ClassAd attributes list in python bindings



Hi Alessandro,

Looking at the code for condor_submit, it appears to simply copy the tool's environment variables into the Env string.  You can do the same with os.environ and some string manipulation.

Oddly enough, we don't provide a function to convert a python list to an environment string.  I'll add that to my list.  It would be nice if you could do something like:

ad["Env"] = classad.dictToEnv(os.environ)

Brian

> On Mar 12, 2015, at 6:18 AM, Alessandro <a.sabellico@xxxxxxxxx> wrote:
> 
> Hello everyone,
> I'm trying to submit a job with getenv variable set to True , through python binding.
> 
> I couldn't find any reference to "getenv"  in classad language definition. Is it correct to define the variable like this:
> 
> ad['GetEnv'] = True
> 
> ?
> 
> Thank you,
> Alessandro
> 
> 2014-01-22 10:52 GMT+01:00 Alessandro <a.sabellico@xxxxxxxxx>:
> Maybe my question about sourcing a file to define the environment for a job has been misunderstood.
> 
> To be more concrete I explain the real problem. I need to run some jobs on Condor that basically call an OpenFOAM solver (simpleFoam) to do a fluido dynamic simulation. 
> 
> In order to work with OpenFOAM I need to source a bashrc file installed in the worker machine (this file: https://github.com/OpenFOAM/OpenFOAM-2.2.x/blob/master/etc/bashrc). Even if the file is sourced system-wide in /etc/bash.bashrc, whenever I run a simulation as a condor job the file is not source by the condor user. 
> 
> So i'm wondering if there's a way to source that file "condor-wide" or on a per-job basis (my job executable is a Python script).
> 
> Thank you all for your help,
> Alessandro
> 
> 
> 2014/1/8 Brian Bockelman <bbockelm@xxxxxxxxxxx>
> 
> On Jan 8, 2014, at 7:47 AM, Alessandro <a.sabellico@xxxxxxxxx> wrote:
> 
> > Thank you for your answers! I did a dump with condor_submit and got all informations from there.
> >
> > I have 2 more question. Sorry about that i'm new to htcondor, and even if I read the manual I couldn't find this informations.
> >
> > I'm using STARTER_JOB_ENVIRONMENT in my nodes configuration files to define some environment variables used during jobs. Now i would need to source a file with some others environment variables definition (actually an OpenFOAM environment definition). is it possible to source a bash file from condor configuration file?
> 
> This is covered here:
> 
> http://research.cs.wisc.edu/htcondor/manual/v8.1/3_3Configuration.html#SECTION00431400000000000000
> 
> Basically,
> 
> LOCAL_CONFIG_FILE=/path/to/script.sh|
> 
> The script output is parsed as configuration variables.
> 
> >
> > the second question is: is it possibile to "label" the starter nodes (for example node 1 is LABEL_A, LABEL_B, LABEL_C ; node 2 is LABEL_D, LABEL_A) and then assign a job with LABEL_X to an appropriate node?
> >
> 
> You can use STARTD_ATTRS to produce the labels (or, if they aren't static, use a STARTD_CRON to launch a script which outputs the labels) which appear in the machine's classad.
> 
> Then, you can use Requirements (http://research.cs.wisc.edu/htcondor/manual/v8.1/2_5Submitting_Job.html#SECTION00352000000000000000) in the jobs to make sure a given job requires a particular label to be present.
> 
> Brian
> 
> 
> _______________________________________________
> HTCondor-users mailing list
> To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
> subject: Unsubscribe
> You can also unsubscribe by visiting
> https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users
> 
> The archives can be found at:
> https://lists.cs.wisc.edu/archive/htcondor-users/
> 
> 
> 
> -- 
> "I Re, i Signori, i ricchi si sono divisi fra loro la terra inventando due tremende parole, il mio e il tuo, siepe di ferro tra te e i tuoi bisogni. Nessuno ha diritto al superfluo fino a che vi sarà un sol uomo che manchi del necessario"
> 
> 
> 
> 
> -- 
> "I Re, i Signori, i ricchi si sono divisi fra loro la terra inventando due tremende parole, il mio e il tuo, siepe di ferro tra te e i tuoi bisogni. Nessuno ha diritto al superfluo fino a che vi sarà un sol uomo che manchi del necessario"
> 
> _______________________________________________
> HTCondor-users mailing list
> To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
> subject: Unsubscribe
> You can also unsubscribe by visiting
> https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users
> 
> The archives can be found at:
> https://lists.cs.wisc.edu/archive/htcondor-users/