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

Re: [HTCondor-users] Making transfer_output / transfer_error depend on ExitCode

Yes. I think a wrapper script is the only way to do what you want for now. 

For the curious ---   

The evaluation of transfer_output happens in condor_submit because submit needs to know if it needs to alter the job's requirements expression to avoid matching the job with a machine that does not have file transfer capability.  

Submit also knows that the list of files to transfer must be wrapped in quotes, so it does not allow the output list to be an expression, it wraps whatever you specify in the submit file in quotes,  The only way to make it an expression in the job classad would be to use the +Attr syntax to bypass the submit quoting behavior, like this

+TransferOut = IfThenElse((ExitBySignal =?= True) || (ExitCode =!=0), OutFilesOnError, OutFilesOnSuccess)
+OutFilesOnError = "file1, file2"
+OutFilesOnSuccess = "file1"

The above behavior will bypass the code in submit that quotes the transfer_output line, but it will also bypass the logic that
alters the job's requirements to make sure it lands on a machine that can do  file transfer.   As before, I don't think this is 
really going to work, because I suspect that these expressions get evaluated too early in the Shadow/Starter and some points of
evaluation may not even have access to the current ExitCode attribute of the job.

The output and error submit keywords have a similar issue, but the processing of them is even more complicated so I'm
quite sure that they cannot be expressions at this time. 

We do have some plans to change the way input and output lists are communicated to the Startd.  I will make sure that 
conditional transfer is also something we consider in that discussion. 


-----Original Message-----
From: Oliver Freyermuth <freyermuth@xxxxxxxxxxxxxxxxxx> 
Sent: Tuesday, July 2, 2019 4:47 PM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>; John M Knoeller <johnkn@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] Making transfer_output / transfer_error depend on ExitCode

Dear TJ,

Am 02.07.19 um 21:52 schrieb John M Knoeller:
> You could try
> transfer_output = (ExitBySignal =?= True) || (ExitCode =!= 0)
> (I assumed that you meant to invert the expression logic, since that's what you said he wanted)

oh yes - of course, you are right, the logic was backwards, and of course the special =!=/=?= operators should help to get around the submission part
(but they already show the evaluation seems to happen too early). 

Submission works that way, of course - but as you already presumed, it does not really work, i.e. output is just always transferred. I also tried some ifThenElse contruction
in assigning "Output = ", but that fails since it does not seem to be evaluated as expression (the evaluator then prefixes the "ifThenElse" with the current path, assuming it's a filename). 

So it seems the only way (for now) is for the user to do that in a wrapper script around the job, right? 
At least for a simple exit code from the main job executable, this should work (e.g. write the output to a file in scratch and echo it at the end / copy it to some other persistent storage
instead of file transfer). Of course, this makes condor_tail etc. a bit harder, but it seems the only workaround. 

Other ideas of course welcome ;-). 


> Using =?= and =!=  will make this always evaluate to a Boolean - which gets you past the submission problem. 
> But I'm not sure if it's actually going to *work* if the result of evaluation changes from false at submission time to true when the job exits with failure.
> -tj
> -----Original Message-----
> From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> On Behalf Of Oliver Freyermuth
> Sent: Tuesday, July 2, 2019 2:58 AM
> To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
> Subject: [HTCondor-users] Making transfer_output / transfer_error depend on ExitCode
> Dear HTCondor experts,
> one of our users had a rather simple question, but it seems the solution is not as easy as expected (or I am missing something).
> He wants to transfer job output (stdout) and error (stderr) back to the submit node via file transfer only if the job exits with an exit-code != 0.
> I tried:
> ------------
> transfer_output=(ExitBySignal == False) && (ExitCode == 0)
> ------------
> but during submission, this yields:
> ------------
> Submitting job(s) ERROR: transfer_output=(ExitBySignal == False) && (ExitCode == 0) is invalid, must eval to a boolean.
> ------------
> I presume by design this must be evaluated on submission (to decide if the file permission checks need to be done, which were in the past done during submission by default).
> Is there another way?
> Cheers,
> 	Oliver
> _______________________________________________
> 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/