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

Re: [HTCondor-users] enforce classad values in submit file

On 3/18/2016 12:15 PM, Thomas Hartmann wrote:
> hi, is there any way to enforce certain classads expressions in a
> submit file?
> to be more specific, i want this classad to be used for every job and
> i want to prevent users from changing it:
> request_memory = ifThenElse(MemoryUsage =!= UNDEFINED, ( MemoryUsage
> ) * 3 / 2, 1024)
> another possibility might be using SUBMIT_REQUIREMENT_.... so a job
> with a request_memory different from what is specified would be
> rejected. but the problem would be here, that the expression would be
> evaluated first, so i could not check for the ifthenelse expression,
> right?

Hi Thomas,

This is an area we are planning to improve soon in the v8.5 series to make it easier for the admin.  But for right now in currently released versions of HTCondor, I think you can indeed check for the ifthenelse expression via SUBMIT_REQUIREMENT by using the unparse() ClassAd built-in function in your SUBMIT_REQUIREMENTS expression.  See the docs for ClassAd functions at http://is.gd/AmcY3X

So I am thinking today you could append something like the following in your condor_config :

  JOB_DEFAULT_REQUESTMEMORY = ifthenelse(x,y,z)
  SUBMIT_REQUIREMENT_MEMORY = unparse(RequestMemory) =?= "ifthenelse(x,y,z)"
  SUBMIT_REQUIREMENT_MEMORY_REASON = "You are not allowed to set request_memory"

Before setting up the above, you will probably want to do a condor_q -l on a job that has your desired RequestMemory attribute so you can get the whitespacing correct to compare against unparse().  Note that the PROTECTED_JOB_ATTRS setting, which appeared in v8.5.2, will prevent a determined user from changing these attributes after submission with condor_qedit or chirp.

While I think the above will let you do what you want today, I admit it is kinda clunky, which is why we will be improving it soon so the admin will be easily able to tell the schedd things like "override the value of this attribute upon submission".

Hope this helps