def build_binary():
    with misc.chdir(convention.muta_path):
        misc.call("unset ROCKSDB_LIB_DIR && cargo build --release --example muta-chain")
        with misc.chdir("./devtools/keypair"):
            misc.call("cargo build --release")

    misc.call("rm -rf ./bin/muta")
    misc.call("mkdir -p ./bin/muta")

    a = os.path.join(convention.muta_path, "target/release/examples/muta-chain")
    misc.call(f"cp {a} ./bin/muta")
    a = os.path.join(convention.muta_path, "target/release/muta-keypair")
    misc.call(f"cp {a} ./bin/muta")
def deploy_binary():
    aws_pool.make_pool()
    with misc.chdir("./bin"):
        misc.call("python3 -m zipfile -c muta.zip muta")
        aws_pool.pool.run(f"rm -rf {convention.remote_path}/muta")
        aws_pool.pool.run("rm -rf /tmp/muta.zip")
        for e in aws_pool.pool:
            print(f"{e.host} upload muta.zip")
            e.put("muta.zip", "/tmp/muta.zip")
    aws_pool.pool.run(f"python3 -m zipfile -e /tmp/muta.zip {convention.remote_path}")
    aws_pool.pool.run(f"cd {convention.remote_path}/muta && chmod +x muta-chain && chmod +x muta-keypair")
Example #3
0
    def poll(self, append=False):
        """ Polls current job. """
        from subprocess import Popen
        from shlex import split as split_cmd
        from misc import chdir
        from . import Program
        from pylada.misc import testValidProgram

        # check if we have currently running process.
        # if current process is finished running, closes stdout and stdout.
        if self.current_program[0] is not None:
            if self.current_program[0].poll() is None:
                return
            # kills stdout and stderr.
            if hasattr(self.current_program[1].stdout, 'close'):
                self.current_program[1].stdout.close()
            if hasattr(self.current_program[1].stderr, 'close'):
                self.current_program[1].stderr.close()
            # now remove reference to current program.
            self.current_program = None, None

        # At this point, loop until find something to do.
        found = False
        params = self.jobfolder.params.copy()
        params.update(self.params)
        for i, program in self.jobfolder.iterator(**params):
            if not getattr(program, 'success', False):
                found = True
                break
        # stop if no more jobs.
        if found == False:
            raise IteratorProcess.StopIteration()
        # if stopped on or before previous job, then we have a retrial.
        if i <= self.iter_index:
            if self.nberrors >= self.maxtrials:
                raise IteratorProcess.StopIteration()
            self.nberrors += 1
        # Open stdout and stderr if necessary.
        with chdir(program.directory):
            file_out = open(program.stdout, "a" if append else "w") \
                if program.stdout is not None else None
            file_err = open(program.stderr, "a" if append else "w") \
                if program.stdout is not None else None

        # now create process.
        program = Program(program.program, program.cmdline, program.directory, fileout, filerr)
        process = Popen(split_cmd(cmd), stdout=file_out, stderr=file_err, cwd=program.directory)
        if testValidProgram:
            process.wait()
        self.current_program = process, program
Example #4
0
def build_binary():
    os.makedirs('./bin/telnet', exist_ok=True)
    with misc.chdir('./telnet'):
        misc.call('go build -o ../bin/telnet/ github.com/libraries/muta_aws_fabric/telnet/cmd/server')
        misc.call('go build -o ../bin/telnet/ github.com/libraries/muta_aws_fabric/telnet/cmd/client')