コード例 #1
0
ファイル: run.py プロジェクト: klonggan/polyaxon
    def create(
        self,
        name=None,
        tags=None,
        description=None,
        content=None,
        base_outputs_path=None,
    ):
        run = polyaxon_sdk.V1Run()
        if self.track_env:
            run.run_env = get_run_env()
        if name:
            run.name = name
        if tags:
            run.tags = tags
        if description:
            run.description = description
        if content:
            try:
                specification = get_specification(data=[content])
            except Exception as e:
                raise PolyaxonClientException(e)
            run.content = specification.config_dump
        else:
            run.is_managed = False

        if self.client:
            try:
                run = self.client.runs_v1.create_run(owner=self.owner,
                                                     project=self.project,
                                                     body=run)
            except (ApiException, HTTPError) as e:
                raise PolyaxonClientException(e)
            if not run:
                raise PolyaxonClientException("Could not create a run.")
        if not settings.CLIENT_CONFIG.is_managed and self.track_logs:
            setup_logging(send_logs=self.send_logs)
        self._run = run
        self._run_uuid = run.uuid
        self.status = "created"

        # Setup the outputs store
        if self.outputs_store is None and base_outputs_path:
            outputs_path = "{}/{}/{}/{}".format(base_outputs_path, self.owner,
                                                self.project, self.run_uuid)
            self.set_outputs_store(outputs_path=outputs_path)

        if self.track_code:
            self.log_code_ref()

        if not settings.CLIENT_CONFIG.is_managed:
            self._start()
        else:
            self._register_wait()

        return self
コード例 #2
0
ファイル: run.py プロジェクト: klonggan/polyaxon
 def log_run_env(self):
     self._update({"run_env": get_run_env()})
コード例 #3
0
ファイル: run.py プロジェクト: deepbluethinker/polyaxon
 def log_run_env(self):
     # TODO: log to file
     return get_run_env()