示例#1
0
    def log_run_env(self):
        if settings.NO_OP:
            return

        patch_dict = {'run_env': get_run_env()}
        self.client.experiment.update_experiment(username=self.username,
                                                 project_name=self.project_name,
                                                 experiment_id=self.experiment_id,
                                                 patch_dict=patch_dict,
                                                 background=True)
示例#2
0
    def create(self,
               name=None,
               backend=None,
               tags=None,
               description=None,
               content=None,
               build_id=None,
               base_outputs_path=None):
        job_config = {'run_env': get_run_env()} if self.track_env else {}
        if name:
            job_config['name'] = name
        if tags:
            job_config['tags'] = tags
        job_config['backend'] = OTHER_BACKEND
        if backend:
            job_config['backend'] = backend
        if description:
            job_config['description'] = description
        if build_id:
            job_config['build_job'] = str(build_id)
        job_config['is_managed'] = settings.IS_MANAGED

        job = None
        if self.client:
            if content:
                job_config['content'] = self.client.project.validate_content(content=content)
            job = self.client.project.create_job(
                username=self.username,
                project_name=self.project_name,
                job_config=job_config,
            )
            if not job:
                raise PolyaxonClientException('Could not create job.')
        if not settings.IS_MANAGED and self.track_logs:
            setup_logging(send_logs=self.send_logs)
        self.job_id = self._get_entity_id(job)
        self.job = job
        self.last_status = 'created'

        # Setup the outputs store
        base_outputs_path = base_outputs_path or get_base_outputs_path()
        if self.outputs_store is None and base_outputs_path:
            outputs_path = '{}/{}/{}/jobs/{}'.format(
                base_outputs_path, self.username, self.project_name, self.job_id)
            self.set_outputs_store(outputs_path=outputs_path)

        if self.track_code:
            self.log_code_ref()

        if not settings.IS_MANAGED:
            self._start()
            self._set_health_url()

        return self
示例#3
0
    def create(self, name=None, tags=None, description=None, config=None, base_outputs_path=None):
        if settings.NO_OP:
            return None

        experiment_config = {'run_env': get_run_env()} if self.track_env else {}
        if name:
            experiment_config['name'] = name
        if tags:
            experiment_config['tags'] = tags
        if description:
            experiment_config['description'] = description
        if config:
            experiment_config['config'] = config

        experiment = self.client.project.create_experiment(
            username=self.username,
            project_name=self.project_name,
            experiment_config=experiment_config,
            group=self.group_id,
        )
        if not experiment:
            raise PolyaxonClientException('Could not create experiment.')
        if not settings.IN_CLUSTER and self.track_logs:
            setup_logging(PolyaxonHandler(send_logs=self._send_logs))
        self.experiment_id = (experiment.id
                              if self.client.api_config.schema_response
                              else experiment.get('id'))
        self.experiment = experiment
        self.last_status = 'created'

        # Setup the outputs store
        base_outputs_path = base_outputs_path or get_base_outputs_path()
        if self.outputs_store is None and base_outputs_path:
            if self.group_id:
                outputs_path = '{}/{}/{}/{}/{}'.format(
                    base_outputs_path,
                    self.username,
                    self.project_name,
                    self.group_id,
                    self.experiment_id)
            else:
                outputs_path = '{}/{}/{}/{}'.format(
                    base_outputs_path, self.username, self.project_name, self.experiment_id)
            self.set_outputs_store(outputs_path=outputs_path)

        if self.track_code:
            self.log_code_ref()

        if not settings.IN_CLUSTER:
            self._start()
            self._set_health_url()

        return self
示例#4
0
    def create(self,
               name=None,
               framework=None,
               backend=None,
               tags=None,
               description=None,
               content=None,
               build_id=None,
               base_outputs_path=None):
        experiment_config = {'run_env': get_run_env()} if self.track_env else {}
        if name:
            experiment_config['name'] = name
        if tags:
            experiment_config['tags'] = tags
        if framework:
            experiment_config['framework'] = framework
        experiment_config['backend'] = OTHER_BACKEND
        if backend:
            experiment_config['backend'] = backend
        if description:
            experiment_config['description'] = description
        if build_id:
            experiment_config['build_job'] = str(build_id)
        experiment_config['is_managed'] = settings.IS_MANAGED

        experiment = None

        if self.client:
            if content:
                experiment_config['content'] = self.client.project.validate_content(content=content)

            experiment = self.client.project.create_experiment(
                username=self.username,
                project_name=self.project_name,
                experiment_config=experiment_config,
                group=self.group_id,
            )
            if not experiment:
                raise PolyaxonClientException('Could not create experiment.')
        if not settings.IS_MANAGED and self.track_logs:
            setup_logging(send_logs=self.send_logs)
        self.experiment_id = self._get_entity_id(experiment)
        self.experiment = experiment
        self.last_status = 'created'

        # Setup the outputs store
        base_outputs_path = base_outputs_path or get_base_outputs_path()
        if self.outputs_store is None and base_outputs_path:
            if self.group_id:
                outputs_path = '{}/{}/{}/{}/{}'.format(
                    base_outputs_path,
                    self.username,
                    self.project_name,
                    self.group_id,
                    self.experiment_id)
            else:
                outputs_path = '{}/{}/{}/{}'.format(
                    base_outputs_path, self.username, self.project_name, self.experiment_id)
            self.set_outputs_store(outputs_path=outputs_path)

        if self.track_code:
            self.log_code_ref()

        if not settings.IS_MANAGED:
            self._start()
            self._set_health_url()

        return self
示例#5
0
 def log_run_env(self):
     self._update({'run_env': get_run_env()})