def make_dataset(self, files, name, time_added=None):
        setid = SetID.random()
        files = [
            File(idx=i,
                 mtime=int(stat.st_mtime * 1000),
                 path=path,
                 size=stat.st_size) for i, (path, stat) in enumerate(
                     (path, os.stat(path)) for path in files)
        ]
        time_added = int(time.time() *
                         1000) if time_added is None else time_added
        dataset = Dataset(
            collection=self.name,
            files=files,
            name=name,
            #status=8,  # pending state see marv/model
            time_added=time_added,
            timestamp=max(x.mtime for x in files),
            setid=setid)

        storedir = self.config.marv.storedir
        store = Store(storedir, self.nodes)
        store.add_dataset(dataset)
        self.render_detail(dataset)
        return dataset
    def make_dataset(self, files, name, time_added=None, discarded=None, setid=None, status=None,
                     timestamp=None, _restore=None):
        setid = setid or SetID.random()
        if _restore:
            files = [File(idx=i, **x) for i, x in enumerate(files)]
        else:
            files = [File(idx=i, mtime=int(utils.mtime(path) * 1000), path=path, size=stat.st_size)
                     for i, (path, stat)
                     in enumerate((path, os.stat(path)) for path in files)]
        time_added = int(utils.now() * 1000) if time_added is None else time_added
        dataset = Dataset(collection=self.name,
                          files=files,
                          name=name,
                          discarded=discarded,
                          status=status,
                          time_added=time_added,
                          timestamp=timestamp or max(x.mtime for x in files),
                          setid=setid)

        storedir = self.config.marv.storedir
        store = Store(storedir, self.nodes)
        store.add_dataset(dataset, exists_okay=_restore)
        self.render_detail(dataset)
        return dataset