Exemplo n.º 1
0
 def _wait_multihost(self, name, launched, tester):
     ssh_results = {}
     for osname, execdict in launched.iteritems():
         logfile = execdict['log']
         loglink = os.path.basename(logfile)
         res = execdict['stdout'].channel.recv_exit_status()
         print("--- AUTO: %s-%s: finished exit code=%d" % (name, osname, res))
         execdict['exit_code']=res
         time.sleep(1)
         util.run_command('ls %s' % logfile)  # in case there are filesystem issues, stat file made an a different host
         logexists = os.path.exists(logfile)
         logfilesize = 0
         if logexists:
             logfilesize = os.path.getsize(logfile)
         ssh_log_link = self.write_ssh_log(name=name, osname=osname, res=res,
                                           logexists=logexists, logfilesize=logfilesize,
                                           stdout=execdict['stdout'],
                                           stderr=execdict['stderr'])
         ssh_results[osname]={'exit_code':res, 'ssh_link':ssh_log_link, 'loglink':None}
         if tester and logexists:
             autoLog = os.path.join(self.logDir, loglink)
             assert autoLog != logfile, "unexpected - log and autoLog file the same: %s" % logfile
             shutil.copyfile(logfile, autoLog)
             time.sleep(1)
             autosize = os.path.getsize(autoLog)
             assert autosize == logfilesize, "copied %s -->%s but old size=%d != new size=%d" % (logfile, autoLog, logfilesize, autosize)
             os.unlink(logfile)
             logfile = autoLog
         if logexists:
             ssh_results[osname]['loglink']=loglink
     return ssh_results
Exemplo n.º 2
0
def checkoutCode(anaTags, master):
    repodict = {'psdm':"https://github.com/lcls-psana",
                'pcds':"file:///afs/slac/g/pcds/svn",
                'user':"******"}

    print("cheking out %d packages from ana tags list" % len(anaTags))
    sys.stdout.flush()

    for pkg, pkgdict in anaTags.iteritems():
        repo = pkgdict['repo']
        assert repo in repodict.keys(), "pkg=%s, don't understand repo=%s" % (pkg, repo)
        assert 'tag' in pkgdict, "no tag defined for pkg=%s, not branches/conda" % pkg
        dest = pkg
        if pkgdict['subdir']:
            dest = '%s/%s' % (pkgdict['subdir'], pkg)
        # get repos from github
        if repo == 'psdm':
            pkgurl = repodict[repo] + '/' + pkg
            if master:
                cmd = 'git clone %s %s' %(pkgurl, dest)
            else:
                cmd = 'git clone --branch %s --depth 1 %s %s' %(pkgdict['tag'], pkgurl, dest)
        # get repos from svn
        else:
            pkgurl = repodict[repo] + '/' + pkg
            pkgurl += '/tags/%s' % pkgdict['tag']
            cmd = 'svn co %s %s' %(pkgurl, dest)
        print("----- %s ----" % cmd)
        sys.stdout.flush()
        stdout, stderr=run_command(cmd)
        if repo != 'psdm':
            assert stderr=='', "error with cmd: %s\n  stderr=%s" % (cmd, stderr)
        print(stdout)
        sys.stdout.flush()
Exemplo n.º 3
0
def getLatestTagSvn(tagurl):
    PRODUCTION_TAG = re.compile('^V\d\d-\d\d-\d\d')
    cmd = 'svn ls %s' % tagurl
    stdout, stderr = run_command(cmd, quiet=True)
    assert stderr=='', "stderr from cmd=%s\n%s" % (cmd, stderr)
    tags = []
    for tag in stdout.split('\n'):
        if PRODUCTION_TAG.match(tag):
            tags.append(tag)
    tags.sort()
    if len(tags)==0: return None
    return tags[-1]
Exemplo n.º 4
0
    def getPackageFileName(self):
        '''Get the name of the output package file that will be produced from
        the conda build.
        '''
        cmd = 'conda-build %s' % self.xtra_build_args

        if self.python_ver:
            cmd += ' --python=%s' % (self.python_ver, )
        if self.numpy_ver:
            cmd += ' --numpy=%s' % (self.numpy_ver, )

        cmd += ' --output %s' % self.recipe_path
        stdout, stderr = util.run_command(cmd)
        stderr_no_warnings = util.strip_warnings_and_harmless_messages(stderr)
        assert len(stderr_no_warnings)==0, "channel=%s pkg=%s problem with cmd=%s: stderr=%s" % \
            (self.channel, self.pkg, cmd, stderr)
        packagefile = stdout.strip()
        return packagefile