Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hardFlush(sys.stderr)
sys.exit(exitval)
def checkExpectArgCount(expectArgCount) :
if len(sys.argv) == expectArgCount : return
badUsage("Incorrect argument count, expected: %i observed: %i\n" % (expectArgCount, len(sys.argv)))
runid = "unknown"
taskStr = "unknown"
if len(sys.argv) > 2 :
runid = sys.argv[1]
taskStr = sys.argv[2]
bling = StringBling(runid, taskStr)
# send a signal for wrapper start as early as possible to help ensure hostname is logged
pffp = sys.stderr
bling.wrapperLog(pffp, "[wrapperSignal] wrapperStart")
checkExpectArgCount(4)
picklefile = sys.argv[3]
# try multiple times to read the argument file in case of NFS delay:
#
retryDelaySec = 30
maxTrials = 3
for _ in range(maxTrials) :
if os.path.exists(picklefile) : break
time.sleep(retryDelaySec)