Skip to content

Commit

Permalink
LocalDataset: Store remote dataset id in the manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
girgink committed Mar 22, 2023
1 parent 138a685 commit 03c587a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/fairly/dataset/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ def upload(self, repository=None, notify: Callable=None, strategy: str="auto", f
raise ValueError("Invalid repository")

# Prevent upload if a remote version exists and upload is not enforced
if client.id in self.remote_datasets and not force:
if client.repository_id in self.remote_datasets and not force:
# TODO: Check if remote dataset is valid, otherwise force upload
raise Warning("Remote dataset exists")

# Create dataset
Expand Down Expand Up @@ -484,6 +485,14 @@ def upload(self, repository=None, notify: Callable=None, strategy: str="auto", f
client.delete_dataset(dataset.id)
raise

# Add remote dataset id to the manifest if known repository
if client.repository_id:
manifest = self._get_manifest()
if "remotes" not in manifest:
manifest["remotes"] = {}
manifest["remotes"][client.repository_id] = dataset.id
self._set_manifest(manifest)

return dataset


Expand Down

0 comments on commit 03c587a

Please sign in to comment.