예제 #1
0
 def _create_cli(self, worksheet_uuid):
     manager = CodaLabManager(
         temporary=True,
         clients={settings.BUNDLE_SERVICE_URL: self.client})
     manager.set_current_worksheet_uuid(self.client, worksheet_uuid)
     cli = bundle_cli.BundleCLI(manager, headless=True)
     return cli
예제 #2
0
파일: legacy.py 프로젝트: see4c/codalab-cli
 def _create_cli(self, worksheet_uuid):
     output_buffer = StringIO()
     manager = CodaLabManager(temporary=True,
                              clients={'local': self.client})
     manager.set_current_worksheet_uuid(self.client, worksheet_uuid)
     cli = bundle_cli.BundleCLI(manager,
                                headless=True,
                                stdout=output_buffer,
                                stderr=output_buffer)
     return cli, output_buffer
예제 #3
0
    def _create_cli(self, worksheet_uuid):
        """
        Create an instance of the CLI.

        The CLI uses JsonApiClient to communicate back to the REST API.
        This is admittedly not ideal since now the REST API is essentially
        making HTTP requests back to itself. Future potential solutions might
        include creating a subclass of JsonApiClient that can reroute HTTP
        requests directly to the appropriate Bottle view functions.
        """
        output_buffer = StringIO()
        rest_client = JsonApiClient(self._rest_url(), lambda: get_user_token())
        manager = CodaLabManager(
            temporary=True,
            config=local.config,
            clients={
                self._rest_url(): rest_client
            })
        manager.set_current_worksheet_uuid(self._rest_url(), worksheet_uuid)
        cli = bundle_cli.BundleCLI(manager, headless=True, stdout=output_buffer, stderr=output_buffer)
        return cli, output_buffer