Ejemplo n.º 1
0
 def test_get_statuses_watch(self, sdk_get_run_statuses):
     settings.CLIENT_CONFIG.watch_interval = 1
     for _ in get_run_statuses(owner="owner",
                               project="project",
                               run_uuid=uuid.uuid4().hex,
                               watch=True):
         resp = MagicMock(status="failed", status_conditions=[])
         sdk_get_run_statuses.return_value = resp
     assert sdk_get_run_statuses.call_count == 2
Ejemplo n.º 2
0
    def _get_run_statuses():
        try:
            for status, conditions in get_run_statuses(owner, project_name,
                                                       run_uuid, watch):
                if not conditions:
                    continue
                Printer.print_header("Latest status:")
                latest_status = Printer.add_status_color({"status": status},
                                                         status_key="status")
                click.echo("{}\n".format(latest_status["status"]))

                objects = list_dicts_to_tabulate([
                    Printer.add_status_color(o.to_dict(), status_key="type")
                    for o in conditions
                ])
                if objects:
                    Printer.print_header("Conditions:")
                    dict_tabulate(objects, is_list_dict=True)
        except (ApiException, HTTPError, PolyaxonClientException) as e:
            handle_cli_error(
                e, message="Could get status for run `{}`.".format(run_uuid))
            sys.exit(1)
Ejemplo n.º 3
0
 def get_statuses(self, watch=False):
     for status, conditions in get_run_statuses(self.owner, self.project,
                                                self.run_uuid, watch):
         self.status = status
         yield conditions
Ejemplo n.º 4
0
 def refresh_data(self):
     self._run = self.client.runs_v1.get_run(self.owner, self.project,
                                             self.run_uuid)
     for status, conditions in get_run_statuses(self.owner, self.project,
                                                self.run_uuid):
         self.status = status
Ejemplo n.º 5
0
 def test_get_statuses(self, sdk_get_run_statuses):
     for _ in get_run_statuses(owner="owner",
                               project="project",
                               run_uuid=uuid.uuid4().hex):
         pass
     assert sdk_get_run_statuses.call_count == 1