Exemple #1
0
# exit action
def _onExit(dir, del_command):
    del_command('rm -rf %s' % dir)


atexit.register(_onExit, tmpDir, MiscUtils.commands_get_output)

# sandbox
if options.verbose:
    tmpLog.debug("=== making sandbox ===")
archiveName = 'jobO.%s.tar' % MiscUtils.wrappedUuidGen()
archiveFullName = os.path.join(tmpDir, archiveName)
extensions = ['json', 'py', 'sh', 'yaml']
find_opt = ' -o '.join(['-name "*.{0}"'.format(e) for e in extensions])
tmpOut = MiscUtils.commands_get_output(
    'find . {0} | tar cvfz {1} --files-from - '.format(find_opt,
                                                       archiveFullName))

if options.verbose:
    print(tmpOut + '\n')
    tmpLog.debug("=== checking sandbox ===")
    tmpOut = MiscUtils.commands_get_output(
        'tar tvfz {0}'.format(archiveFullName))
    print(tmpOut + '\n')

if not options.noSubmit:
    if options.verbose:
        tmpLog.debug("=== uploading sandbox===")
    os.chdir(tmpDir)
    status, out = Client.putFile(archiveName,
                                 options.verbose,