Closed stsievert closed 4 years ago
I got an email back from Christina:
the GPUJobLength needs to be a string, and the quotes were being stripped from your job submission. You need to use this instead:
"GPUJobLength" : '"short"'
Unfortunately, I think this is more of a "gotcha" than a bug. At the end of the day, we can't know whether you intended the value to be a string or not, because there are two "stringish" values going into submit: tokens or references to other values like true
, and strings like "short"
.
In a normal submit file, if you would write
+WantGPULab = true
+GPUJobLength = "short"
then for HTMap you need
htmap.MapOptions(custom_options = {"WantGPULab": "true", "GPUJobLength": '"short"'})
The general rule is something like
the value will be sent to HTCondor as if the contents of the string were in a submit file
... which is unpleasant, but I haven't thought of anything cleverer to do here.
At the minimum, we need a note in the MapOptions
docs that describes the gotcha.
references to other values like true
Ah. It looks like one can also specify transfer_input_files = foo.dat
. Can transfer_input_files = "foo.dat"
be used?
Could MapOptions
take Python types then encode them so condor_submit
will accept them? But that will leaves the difficulty of determining a string or a token. Is there a clean separation between keys that accept strings or tokens?
@JoshKarpel - in the submit file language, attributes not starting with +
are macros to be expanded while those with +
obey ClassAd rules.
Why not do the standard type conversion for +
attributes and macros otherwise? I'm thinking of something like this:
>>> import classad
>>> ad = classad.ClassAd()
>>> map = {"foo": "1", "+bar": classad.ExprTree('strcat(baz, "123")'), "+baz": "yup"}
>>>
>>> for key, val in map.items():
... if key.startswith('+'):
... ad[key[1:]] = val
... map[key] = str(ad.lookup(key[1:]))
...
>>> map
{'foo': '1', '+baz': '"yup"', '+bar': 'strcat(baz,"123")'}
This makes the expected things easy (strings become strings) but keeps hard things hard (arbitrary expressions require you to dig out the underlying library).
I suspect that the internal implementation of this is largely a historical artifact (I don't recall thinking about it much at the time). There's certainly a place in the code to hang that kind of conversion.
However, I don't think that round-tripping through an ad will work as desired in all cases. The one that comes to mind is when you want to use a submit macro in a custom attribute. Example:
>>> import classad
>>> map = {"baz": "$(ClusterId)"}
>>> ad = classad.ClassAd()
>>> ad["baz"] = map["baz"]
>>> ad
[ baz = "$(ClusterId)" ]
>>> str(ad.lookup("baz"))
'"$(ClusterId)"'
which would cause the resulting value in the job ad to be a string instead of an integer.
From a usability perspective, an annoying-but-straightforward rule like the one in my comment above should also make it clear how to translate instructions for what to put it in a submit file into what to put in your MapOptions
(in this case, because the rule wasn't stated anywhere, @stsievert ended up putting the wrong thing in). It's annoying, but means that you get what you put in, which is important since the user can't see the submit description itself (... which we should probably expose that in the logs for debugging purposes).
the submit description itself (... which we should probably expose that in the logs for debugging purposes).
:+1:
an annoying-but-straightforward rule like the one in my comment above should also make it clear how to translate instructions for what to put it in a submit file into what to put in your MapOptions
I also think the solution with clear documentation is best.
Resolved by #196
Describe the bug
I am using these options to launch jobs:
I am running this on CHTC's pool at UW–Madison. When I run this job, I get this error:
This bug report codifies some external discussion in office hours and via email
To Reproduce (to be added if desired)
Expected behavior I do not expect that error.
Software Versions:
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.