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

Re: [HTCondor-users] interpolation using the python bindings



2018-09-10 12:54 GMT-04:00 Todd L Miller <tlmiller@xxxxxxxxxxx>:
>> It looks like this indicates that the Python bindings don't parse and
>> expand submit variables it finds in the dictionary.
>
>
> # So I ran the following Python:
>
> import sys
>
> import htcondor
>
> schedd = htcondor.Schedd()
> submit = htcondor.Submit({
>     'executable'            : '/bin/sleep',
>     'arguments'             : '60',
>     '+special1'             : '$(Cluster)',
>     '+special2'             : '"$(Cluster)"',
>     '+special3'             : ' $(Cluster) ',
>     '+special4'             : ' "$(Cluster)" ',
>     '+special5'             : ' " $(Cluster) " ',
>     'transfer_executable'   : 'false',
>     'should_transfer_files' : 'false',
>     'log'                   : 'jc.log'
> })
>
> try:
>     with schedd.transaction() as txn:
>         cluster_id = submit.queue(txn, 1)
> except Exception as e:
>     print("Job submission failed for an unknown error: " + str(e))
>     sys.exit(-1)
>
> sys.exit(0)
>
> # and got the following results --
> # 'PYTHONPATH=~/condor/install/lib/python python ./jc.py ; condor_q -l |
> grep special'
>
> special1 = 853
> special2 = "853"
> special3 = 853
> special4 = "853"
> special5 = " 853 "
>
> From which you can observe that Condor does some strange things, but not
> expanding macros is really just not one of them (at least for the version of
> the bindings I tried with).  Jose, could you post a small, ideally minimal,
> version of the code that's giving you trouble?
>
> - ToddM
>

Hi Todd,

which version of HTCondor are you using?
I just copied & pasted you snippet, tried myself, and got this error message:

      Job submission failed for an unknown error: Failed to create a
copy of attributes

I am running 8.6.12.
In order to eliminate that error, I tried with a simpler version:


    schedd = htcondor.Schedd()
    submit = htcondor.Submit({
        'executable'            : '/bin/sleep',
        'arguments'             : '60',
        '+special2'             : '"$(Cluster)"',
        'transfer_executable'   : 'false',
        'should_transfer_files' : 'false',
        'log'                   : 'tm.log'
    })

And then I get again the same result:


        $ condor_q -l 169893 | grep special
        special2 = "$(Cluster)"


Thanks a lot.
Jose