Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HTCondor-users] What is the proper way to insert expressions into classads using the python bindings?
- Date: Fri, 2 Aug 2013 11:34:11 -0500
- From: Brian Bockelman <bbockelm@xxxxxxxxxxx>
- Subject: Re: [HTCondor-users] What is the proper way to insert expressions into classads using the python bindings?
Hi Tony,
$(Cluster) and $(Process) are a good example of the differences between ClassAds and condor submit file language. Unfortunately, macro expansion, while very useful, does not exist in ClassAds in a manner analogous to the submit file.
You'll want something along these lines:
ad["UserLog"] = classad.ExprTree('strcat("foo", ClusterID, ".", ProcID, ".out")')
Brian
On Jul 22, 2013, at 10:12 AM, Anthony Tiradani <tiradani@xxxxxxxx> wrote:
> Hi,
>
> I have been checking out the python bindings and I have run into a problem inserting expressions into the submit classads with python bindings. In a standard condor submit file I generally specify output and log files with the $(Cluster) and $(Process) expressions in the file names so that I can link the files to the jobs.
>
> For example:
>
> log = $(Cluster).$(Process).out
>
> When I instruct condor_submit to dump the classad rather than perform the submit, I see the output line translated to:
>
> UserLog = "/path/to/submit/directory/..log"
>
> When using the python bindings to submit a job, the "..log" syntax generates a file named "..log". I have tried the following combinations without success:
>
> ad["UserLog"] = "$(ClusterId).$(ProcId).log"
> - results in a file named $(ClusterId).$(ProcId).log
>
> ad["UserLog"] = classad.ExprTree("$(ClusterId).$(ProcId).log")
> - results in "SyntaxError: Unable to parse string into a ClassAd."
>
> ad["UserLog"] = "%s.%s.log" % (str(classad.ExprTree("ClusterId")), str(classad.ExprTree("ProcId")))
> - results in a file named ClusterId.ProcId.out
>
> ad["UserLog"] = "%s.%s.log" % (str(classad.ExprTree("$(ClusterId)")), str(classad.ExprTree("$(ProcId)")))
> - results in "SyntaxError: Unable to parse string into a ClassAd."
>
> ad["UserLog"] = "%s.%s.log" % (str(classad.ExprTree("$$(ClusterId)")), str(classad.ExprTree("$$(ProcId)")))
> - results in "SyntaxError: Unable to parse string into a ClassAd."
>
> What is the proper way to insert expressions into classads using the python bindings?
>
> Thanks,
>
> --
> Anthony Tiradani
> tiradani@xxxxxxxx
> +1 630 840 4479
>
>
> _______________________________________________
> 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/