Пример #1
0
    def _push_model_with_metrics(self, entity_name):
        init_repository(MODELS, self)
        workspace = os.path.join(self.tmp_dir, MODELS, entity_name)
        api.create(MODELS, entity_name, categories=['computer-vision', 'images'],
                   mutability=STRICT, bucket_name='mlgit')
        os.makedirs(os.path.join(workspace, 'data'), exist_ok=True)
        self.create_file(workspace, 'file1', '0')

        api.add(MODELS, entity_name, metric={'accuracy': 10.0,
                                             'precision': 10.0})
        api.commit(MODELS, entity_name)
        api.push(MODELS, entity_name)
Пример #2
0
    def set_up_test(self):
        init_repository('dataset', self)

        workspace = os.path.join(self.tmp_dir, 'dataset', 'dataset-ex')

        os.makedirs(workspace, exist_ok=True)

        spec = {
            'dataset': {
                'categories': ['computer-vision', 'images'],
                'manifest': {
                    'files': 'MANIFEST.yaml',
                    'store': 's3h://mlgit'
                },
                'mutability': Mutability.STRICT.value,
                'name': 'dataset-ex',
                'version': 9
            }
        }

        with open(os.path.join(workspace, 'dataset-ex.spec'), 'w') as y:
            yaml_processor.dump(spec, y)

        os.makedirs(os.path.join(workspace, 'data'), exist_ok=True)

        self.create_file(workspace, 'file1', '0')
        self.create_file(workspace, 'file2', '1')
        self.create_file(workspace, 'file3', 'a')
        self.create_file(workspace, 'file4', 'b')

        api.add('dataset', 'dataset-ex', bumpversion=True)
        api.commit('dataset', 'dataset-ex')
        api.push('dataset', 'dataset-ex')

        self.assertTrue(
            os.path.exists(os.path.join(self.tmp_dir, self.metadata)))

        clear(os.path.join(self.tmp_dir, ML_GIT_DIR))
        clear(workspace)
        init_repository('dataset', self)
Пример #3
0
    def set_up_test(self):
        init_repository(DATASETS, self)

        workspace = os.path.join(self.tmp_dir, DATASETS, DATASET_NAME)

        os.makedirs(workspace, exist_ok=True)

        spec = {
            DATASET_SPEC_KEY: {
                'categories': ['computer-vision', 'images'],
                'manifest': {
                    'files': 'MANIFEST.yaml',
                    STORAGE_SPEC_KEY: '%s://mlgit' % S3H
                },
                'mutability': STRICT,
                'name': DATASET_NAME,
                'version': 10
            }
        }

        with open(os.path.join(workspace, 'datasets-ex.spec'), 'w') as y:
            yaml_processor.dump(spec, y)

        os.makedirs(os.path.join(workspace, 'data'), exist_ok=True)

        self.create_file(workspace, 'file1', '0')
        self.create_file(workspace, 'file2', '1')
        self.create_file(workspace, 'file3', 'a')
        self.create_file(workspace, 'file4', 'b')

        api.add(DATASETS, DATASET_NAME)
        api.commit(DATASETS, DATASET_NAME)
        api.push(DATASETS, DATASET_NAME)

        self.assertTrue(
            os.path.exists(os.path.join(self.tmp_dir, self.metadata)))

        clear(os.path.join(self.tmp_dir, ML_GIT_DIR))
        clear(workspace)
        init_repository(DATASETS, self)
Пример #4
0
 def test_03_labels_push(self):
     self.set_up_test(LABELS)
     cache = os.path.join(self.tmp_dir, ML_GIT_DIR, LABELS, 'cache')
     api.push(LABELS, 'labels-ex', 2, False)
     self.assertTrue(os.path.exists(cache))
     self.assertFalse(os.path.isfile(os.path.join(cache, STORAGE_LOG)))
Пример #5
0
 def test_02_model_push(self):
     self.set_up_test(MODELS)
     cache = os.path.join(self.tmp_dir, ML_GIT_DIR, MODELS, 'cache')
     api.push(MODELS, 'models-ex', 2, False)
     self.assertTrue(os.path.exists(cache))
     self.assertFalse(os.path.isfile(os.path.join(cache, STORAGE_LOG)))
Пример #6
0
 def test_01_dataset_push(self):
     self.set_up_test(DATASETS)
     cache = os.path.join(self.tmp_dir, ML_GIT_DIR, DATASETS, 'cache')
     api.push(DATASETS, DATASET_NAME, 2, False)
     self.assertTrue(os.path.exists(cache))
     self.assertFalse(os.path.isfile(os.path.join(cache, STORAGE_LOG)))