Beispiel #1
0
 def list(self, project):
     count = 0
     selected = self.ctx.config.get('dataset', None)
     for dataset in iter(DataSet(self.ctx, project).list()):
         self.ctx.log(('[%s] ' %
                       ('x' if selected == dataset.get('name') else ' ')) +
                      dataset.get('name'))
         count += 1
     self.ctx.log('%s DataSet(s) listed' % str(count))
     return {'datasets': DataSet(self.ctx, project).list()}
Beispiel #2
0
    def create_project(self):
        try:
            project_path = self.mk_project_folder()
        except AugerException as e:
            self.ctx.log(str(e))
            sys.exit(1)
        Template.copy_config_files(project_path)

        self.ctx.config.load(project_path)
        if self.source:
            try:
                self.source = DataSet.verify(self.source)[0]
            except Exception as e:
                self.ctx.log(str(e))
                sys.exit(1)

        AugerConfig(self.ctx).config(target=self.target,
                                     source=self.source,
                                     model_type=self.model_type,
                                     project_name=self.project_name)

        self.ctx.log(
            "Next, please go to project dir: cd %s\n"
            "Select or create data set on Auger Cloud: "
            "augerai dataset create|select\n"
            "Configure your experiment by editing auger.yaml\n"
            "And run the experiment: augerai experiment start\n"
            "After that you can use your model: augerai model deploy && "
            "augerai model predict <target_data>" % self.project_name)
Beispiel #3
0
 def delete(self, project, name):
     if name is None:
         name = self.ctx.get_config('auger').get('dataset', None)
     DataSet(self.ctx, project, name).delete()
     if name == self.ctx.get_config('auger').get('dataset', None):
         AugerConfig(self.ctx).set_data_set(None).set_experiment(None)
     self.ctx.log('Deleted dataset %s' % name)
Beispiel #4
0
 def create(self, project, source=None):
     if source is None:
         source = self.ctx.config.get('source', None)
     dataset = DataSet(self.ctx, project).create(source)
     AugerConfig(self.ctx).set_data_set(dataset.name, source)
     self.ctx.log('Created DataSet %s' % dataset.name)
     return {'created': dataset.name}
Beispiel #5
0
 def wrapper(self, *args, **kwargs):
     project = _get_project(self, False)
     data_set_name = self.ctx.config.get('dataset', None)
     if data_set_name is None:
         raise AugerException(
             'Please specify dataset name in auger.yaml/dataset...')
     dataset = DataSet(self.ctx, project, data_set_name)
     return decorated(self, dataset, *args, **kwargs)
Beispiel #6
0
 def prepare_dataset(self):
     """check whether dataset selected, if not, select or create one"""
     self.ctx.log("Checking dataset...")
     selected = self.ctx.config.get('dataset', None)
     if selected is None:
         if DATASET_NAME in self._get_datasets():
             # try to select existing
             AugerConfig(self.ctx).set_data_set(DATASET_NAME,
                                                '').set_experiment(None)
             self.dataset = DataSet(self.ctx, self.project, DATASET_NAME)
         else:
             # or create new
             self.ctx.log("No dataset found, creating the first one...")
             source = self.ctx.config.get('source', None)
             dataset = DataSet(self.ctx, self.project).create(source)
             AugerConfig(self.ctx).set_data_set(dataset.name,
                                                source).set_experiment(None)
             self.dataset = DataSet(self.ctx, self.project, dataset.name)
     else:
         self.dataset = DataSet(self.ctx, self.project, selected)
         self.ctx.log("Currently selected: %s" % selected)
Beispiel #7
0
 def list(self, project):
     count = 0
     for dataset in iter(DataSet(self.ctx, project).list()):
         self.ctx.log(dataset.get('name'))
         count += 1
     self.ctx.log('%s DataSet(s) listed' % str(count))
Beispiel #8
0
 def download(self, project, name, path_to_download):
     if name is None:
         name = self.ctx.config.get('dataset', None)
     file_name = DataSet(self.ctx, project, name).download(path_to_download)
     self.ctx.log('Downloaded dataset %s to %s' % (name, file_name))
     return {'dowloaded': name, 'file': file_name}
Beispiel #9
0
 def _get_datasets(self):
     """return list of existing datasets in the Aguer Cloud"""
     dataset_list = []
     for dataset in iter(DataSet(self.ctx, self.project).list()):
         dataset_list.append(dataset['name'])
     return dataset_list