Ejemplo n.º 1
0
def g_create_dir(dirname):
    res = SH.cmd('galaxy shell mkdir %s' % shell.escape(dirname))
    if not g_has_dir(dirname):
        error("Failed to create directory: %s" % dirname)
        error(SH.apply_aliases('galaxy shell mkdir %s' % shell.escape(dirname)))
        error(res)
    else:
        log("Successfully created directory: %s" % dirname)
Ejemplo n.º 2
0
def push_to(i_fname, g_dirname, g_filename):
    i_fname = shell.escape(i_fname)
    g_dirname = shell.escape(g_dirname)
    res = SH.cmd('galaxy push %(i_fname)s %(g_dirname)s' % locals())
    if not g_has_file(g_filename):
        error("Failed to push file: %s" % g_filename)
        error(SH.apply_aliases('galaxy push %(i_fname)s %(g_dirname)s' % locals()))
        error(res)
    else:
        log("Successfully pushed %s to %s.\n" % (i_fname, g_dirname))
Ejemplo n.º 3
0
def check_exists(string, flag):
    path = shell.escape(string)
    cmd = "if [ %s %s ]; then echo 'Exists'; else echo 'Not found'; fi" % (
        flag, path)
    command = 'galaxy shell "%s"' % cmd
    aliased = SH.apply_aliases(command)
    res = SH.cmd(command)
    if 'Exists' in res:
        return True
    elif 'Not found' in res:
        return False
    else:
        error("Invalid result from command %s" % aliased)
        error(res)
Ejemplo n.º 4
0
    def export(self, destTag, destSince, userComment):
        self.exportTag = destTag
        self.exportSince = str(destSince)

        # We could use a list for Popen to avoid escaping and shell=True,
        # but this way it is easier to read in the logs and we get a working
        # command that could be copied and rerun easily
        command = "cmscond_export_iov" + \
                  " -s " + shell.escape(self.srcDB) + \
                  " -i " + shell.escape(self.inputTag) + \
                  " -d " + shell.escape(self.exportDB) + \
                  " -t " + shell.escape(self.exportTag) + \
                  " -b " + shell.escape(self.exportSince) + \
                  " -l " + shell.escape(self.logDB) +\
                  " -x " + shell.escape(userComment) + \
                  " -P " + shell.escape(self.authpath)

        return self.executeAndLog(command, True)
Ejemplo n.º 5
0
    def export(self, destTag, destSince, userComment ):
        self.exportTag = destTag
        self.exportSince = str(destSince)

        # We could use a list for Popen to avoid escaping and shell=True,
        # but this way it is easier to read in the logs and we get a working
        # command that could be copied and rerun easily
        command = "cmscond_export_iov" + \
                  " -s " + shell.escape(self.srcDB) + \
                  " -i " + shell.escape(self.inputTag) + \
                  " -d " + shell.escape(self.exportDB) + \
                  " -t " + shell.escape(self.exportTag) + \
                  " -b " + shell.escape(self.exportSince) + \
                  " -l " + shell.escape(self.logDB) +\
                  " -x " + shell.escape(userComment) + \
                  " -P " + shell.escape(self.authpath)

        return self.executeAndLog( command, True )
Ejemplo n.º 6
0
    def duplicate(self, destTag, destSince):
        duplicateSince = str(destSince)
        if (self.exportTag == None):
            self.fileLogger.error('Tag Export has not been done.')
            return False

        # Same note as for the export command (see above)
        command = "cmscond_duplicate_iov" + \
                    " -c " + shell.escape(self.exportDB) + \
                    " -t " + shell.escape(self.exportTag) + \
                    " -f " + shell.escape(self.exportSince) + \
                    " -d " + shell.escape(destTag) + \
                    " -s " + shell.escape(duplicateSince) + \
                    " -l " + shell.escape(self.logDB) +\
                    " -P " + shell.escape(self.authpath)

        return self.executeAndLog(command, True)
Ejemplo n.º 7
0
    def duplicate(self, destTag, destSince):
        duplicateSince = str(destSince)
        if( self.exportTag == None ):
           self.fileLogger.error('Tag Export has not been done.')
           return False

        # Same note as for the export command (see above)
        command = "cmscond_duplicate_iov" + \
                    " -c " + shell.escape(self.exportDB) + \
                    " -t " + shell.escape(self.exportTag) + \
                    " -f " + shell.escape(self.exportSince) + \
                    " -d " + shell.escape(destTag) + \
                    " -s " + shell.escape(duplicateSince) + \
                    " -l " + shell.escape(self.logDB) +\
                    " -P " + shell.escape(self.authpath)

        return self.executeAndLog( command, True )