def run(self):
        super().run()

        # validation checks
        self.usercfg.assert_valid_user()

        service = Service(self.hutcfg, self.usercfg.username)

        # run the contract regardless
        rpc.generate_contract_file()

        if self.local:
            # call build+push first using Docker builder
            if not self.no_build:
                service.build_push(force=self.force, push=True, dev=self.dev)
        else:
            import tempfile
            import requests
            import os.path
            from .common import utils
            from stackhut_client import client
            log.info("Starting Remote build, this may take a while (around 2-3m the first time), please wait...")

            # compress and upload the service
            with tempfile.NamedTemporaryFile(suffix='.tar.gz', delete=False) as f:
                f.close()

            # get the upload url
            r_file = stackhut_api_user_call('file', dict(filename=os.path.basename(f.name)), self.usercfg)

            sh.tar('-czvf', f.name, '--exclude', ".git", '--exclude', "__pycache__", '--exclude', "run_result", '--exclude', ".stackhut", '.')
            log.debug("Uploading package {} ({:.2f} Kb)...".format(f.name, 1024/os.path.getsize(f.name)))
            with open(f.name, 'rb') as f1:
                with Spinner():
                    r = requests.put(r_file['url'], data=f1)
                r.raise_for_status()
            # remove temp file
            os.unlink(f.name)

            # call the remote build service
            auth = client.SHAuth(self.usercfg.username, hash=self.usercfg['hash'])
            sh_client = client.SHService('stackhut', 'stackhut', auth=auth, host=utils.SERVER_URL)
            log.debug("Uploaded package, calling remote build...")
            try:
                with Spinner():
                    r = sh_client.Default.remoteBuild(r_file['key'], self.dev)

            except client.SHRPCError as e:
                log.error("Build error, remote build output below...")
                log.error(e.data['output'])
                return 1
            else:

                log.debug("Remote build output...\n" + r['cmdOutput'])
                if not r['success']:
                    raise RuntimeError("Build failed")
                log.info("Completed Remote build")

        # Inform the SH server re the new/updated service
        # build up the deploy message body
        test_request = json.loads(self._read_file('test_request.json'))
        readme = self._read_file('README.md')

        data = {
            'service': service.short_name,  # StackHut Service,
            'github_url': self.hutcfg.github_url,
            'example_request': test_request,
            'description': self.hutcfg.description,
            'private_service': self.hutcfg.private,
            'readme': readme,
            'schema': self.create_methods()
        }

        log.info("Deploying image '{}' to StackHut".format(service.short_name))
        r = stackhut_api_user_call('add', data, self.usercfg)
        log.info("Service {} has been {} and is live".format(service.short_name, r['message']))
        log.info("You can now call this service with our client-libs or directly over JSON+HTTP")
        return 0



# StackHut primary toolkit commands
# debug, push, pull, test, etc.
dataset/ETHPy150Open StackHut/stackhut/stackhut_toolkit/commands.py/DeployCmd.run/swapped operands of `/`