This behavior is due to dagman always appending VARS variables to jobs at submission time. I have actually just recently implemented the ability for dagman to prepend variables to so they can be used in dag job conditionals like the one you shared.
A quick look into this feature is that users can add the keyword 'PREPEND' or 'APPEND' to the VARS line in a dag file to choose when the variables are added to the job during submission.
I am not sure when this feature is set to release, but it is on its way.
From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of Marco van Zwetselaar <zwets@xxxxxxxxxx>
Sent: Tuesday, May 31, 2022 1:54 PM
To: htcondor-users@xxxxxxxxxxx <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] "if defined" fails for VARS from DAG
It seems as though VARS defined in a DAG get carried over into the node's job file, but don't make 'if defined' true. Here is a test case:
executable = /usr/bin/echo
if defined A
arguments = "defined A=$(A)"
arguments = "undefined A=$(A)"
output = test.out
VARS test A="42"
JOB test test.job
Now, 'condor_submit A=99 test.job' correctly results in 'defined A=99', whereas 'condor_submit_dag test.dag' results in 'undefined A=42'. This is unexpected: A is undefined, yet appears to have value 42.