Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT "silently" (returns 200) doesn't rename and doesn't update metadata (path remains old) #1682

Closed
yarikoptic opened this issue Sep 15, 2023 · 6 comments · Fixed by #1689
Closed
Labels
bug Something isn't working released This issue/pull request has been released.

Comments

@yarikoptic
Copy link
Member

User reported that dandi move doesn't work : dandi/dandi-cli#1325 .
I have checked test_move tests there -- work fine.
I thought it is zarr specific, have tested on sample files including nwb -- indeed dandi move doesn't do good.
I have tried on a sample file via copy/pasting metadata in swagger -- seems worked.
Trying in pdb session of dandi-cli -- nope. Here trying to rename from bar-renamed to bar-renamed2 -- see that result contains bar-renamed although provided record bar-renamed2:

(Pdb) p path
'/dandisets/000029/versions/draft/assets/e4032a47-141d-4c4c-84c1-2be3ac5aeb33/'

*(Pdb) p json.dumps(kwargs['json'])
'{"metadata": {"access": [{"status": "dandi:OpenAccess", "schemaKey": "AccessRequirements"}], "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", "schemaKey": "Asset", "repository": "http://localhost:8085", "dateModified": "2023-03-16T11:50:06.357489-04:00", "schemaVersion": "0.6.4", "encodingFormat": "application/octet-stream", "wasGeneratedBy": [{"id": "urn:uuid:47f374af-f500-4d10-87ea-ce1dc4e92d45", "name": "Metadata generation", "endDate": "2023-03-16T11:50:06.357462-04:00", "schemaKey": "Activity", "startDate": "2023-03-16T11:50:06.357462-04:00", "description": "Metadata generated by DANDI cli", "wasAssociatedWith": [{"url": "https://github.com/dandi/dandi-cli", "name": "DANDI Command Line Interface", "version": "0.51.0", "schemaKey": "Software", "identifier": "RRID:SCR_019009"}]}], "blobDateModified": "2023-03-13T15:37:42.000759-04:00", "id": "dandiasset:e4032a47-141d-4c4c-84c1-2be3ac5aeb33", "path": "bar-renamed2", "identifier": "e4032a47-141d-4c4c-84c1-2be3ac5aeb33", "contentUrl": ["https://api.dandiarchive.org/api/assets/e4032a47-141d-4c4c-84c1-2be3ac5aeb33/download/", "https://dandiarchive.s3.amazonaws.com/blobs/2fd/746/2fd7464f-5459-4c96-a938-27cf13f4d330"], "contentSize": 4, "digest": {"dandi:dandi-etag": "517a02191c8c9d1013b48b1f295e03a2-1", "dandi:sha2-256": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"}}, "blob_id": "2fd7464f-5459-4c96-a938-27cf13f4d330"}'
(Pdb) p kwargs['json']['metadata']['path']
'bar-renamed2'
(Pdb) self.request("PUT", path, json=kwargs['json'])
{'asset_id': 'e4032a47-141d-4c4c-84c1-2be3ac5aeb33', 'blob': '2fd7464f-5459-4c96-a938-27cf13f4d330', 'zarr': None, 'path': 'bar-renamed', 'size': 4, 'created': '2023-09-15T20:41:51.221272Z', 'modified': '2023-09-15T20:41:51.236057Z', 'metadata': {'access': [{'status': 'dandi:OpenAccess', 'schemaKey': 'AccessRequirements'}], '@context': 'https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json', 'schemaKey': 'Asset', 'repository': 'http://localhost:8085', 'dateModified': '2023-03-16T11:50:06.357489-04:00', 'schemaVersion': '0.6.4', 'encodingFormat': 'application/octet-stream', 'wasGeneratedBy': [{'id': 'urn:uuid:47f374af-f500-4d10-87ea-ce1dc4e92d45', 'name': 'Metadata generation', 'endDate': '2023-03-16T11:50:06.357462-04:00', 'schemaKey': 'Activity', 'startDate': '2023-03-16T11:50:06.357462-04:00', 'description': 'Metadata generated by DANDI cli', 'wasAssociatedWith': [{'url': 'https://github.com/dandi/dandi-cli', 'name': 'DANDI Command Line Interface', 'version': '0.51.0', 'schemaKey': 'Software', 'identifier': 'RRID:SCR_019009'}]}], 'blobDateModified': '2023-03-13T15:37:42.000759-04:00', 'id': 'dandiasset:e4032a47-141d-4c4c-84c1-2be3ac5aeb33', 'path': 'bar-renamed', 'identifier': 'e4032a47-141d-4c4c-84c1-2be3ac5aeb33', 'contentUrl': ['https://api.dandiarchive.org/api/assets/e4032a47-141d-4c4c-84c1-2be3ac5aeb33/download/', 'https://dandiarchive.s3.amazonaws.com/blobs/2fd/746/2fd7464f-5459-4c96-a938-27cf13f4d330'], 'contentSize': 4, 'digest': {'dandi:dandi-etag': '517a02191c8c9d1013b48b1f295e03a2-1', 'dandi:sha2-256': 'b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c'}}}

the same behavior in swagger for that record:

image

Since it worked for me "manual" attempt in swagger, I think smth in metadata record causes dandi-archive to not perform the action but not complain about that.

@satra
Copy link
Member

satra commented Sep 15, 2023

it also says zarr: null and blob: <id>. is the put setting the zarr id when doing the move?

@satra
Copy link
Member

satra commented Sep 15, 2023

i.e was this nwb or zarr specific or neither?

@yarikoptic
Copy link
Member Author

it also says zarr: null and blob: <id>. is the put setting the zarr id when doing the move?

I guess so.

BTW -- I am not failing to reproduce working behavior while manually copying metadata record and just changing path and adding blob_id field... so dunno.

here is full curl command
curl -X 'PUT' \
  'https://api.dandiarchive.org/api/dandisets/000029/versions/draft/assets/e4032a47-141d-4c4c-84c1-2be3ac5aeb33/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFToken: SENSORED' \
  -d '{"metadata": {
  "access": [
    {
      "status": "dandi:OpenAccess",
      "schemaKey": "AccessRequirements"
    }
  ],
  "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json",
  "schemaKey": "Asset",
  "repository": "http://localhost:8085",
  "dateModified": "2023-03-16T11:50:06.357489-04:00",
  "schemaVersion": "0.6.4",
  "encodingFormat": "application/octet-stream",
  "wasGeneratedBy": [
    {
      "id": "urn:uuid:47f374af-f500-4d10-87ea-ce1dc4e92d45",
      "name": "Metadata generation",
      "endDate": "2023-03-16T11:50:06.357462-04:00",
      "schemaKey": "Activity",
      "startDate": "2023-03-16T11:50:06.357462-04:00",
      "description": "Metadata generated by DANDI cli",
      "wasAssociatedWith": [
        {
          "url": "https://github.com/dandi/dandi-cli",
          "name": "DANDI Command Line Interface",
          "version": "0.51.0",
          "schemaKey": "Software",
          "identifier": "RRID:SCR_019009"
        }
      ]
    }
  ],
  "blobDateModified": "2023-03-13T15:37:42.000759-04:00",
  "id": "dandiasset:e4032a47-141d-4c4c-84c1-2be3ac5aeb33",
  "path": "bar-renamed3",
  "identifier": "e4032a47-141d-4c4c-84c1-2be3ac5aeb33",
  "contentUrl": [
    "https://api.dandiarchive.org/api/assets/e4032a47-141d-4c4c-84c1-2be3ac5aeb33/download/",
    "https://dandiarchive.s3.amazonaws.com/blobs/2fd/746/2fd7464f-5459-4c96-a938-27cf13f4d330"
  ],
  "contentSize": 4,
  "digest": {
    "dandi:dandi-etag": "517a02191c8c9d1013b48b1f295e03a2-1",
    "dandi:sha2-256": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c"
  }
}, "blob_id": "2fd7464f-5459-4c96-a938-27cf13f4d330"}'

i.e was this nwb or zarr specific or neither?

seems non-specific, i.e I am reproducing on regular .nwb.

@yarikoptic yarikoptic changed the title PUT "silently" (returns 200) and doesn't update metadata (path remains old) PUT "silently" (returns 200) doesn't rename and doesn't update metadata (path remains old) Sep 17, 2023
@yarikoptic yarikoptic added the bug Something isn't working label Sep 20, 2023
@waxlamp
Copy link
Member

waxlamp commented Sep 20, 2023

I just tried to move a file using dandi-cli and the staging instance -- and it worked as expected (the file I tested on bypassed validation during upload, hello.txt). So I'm fuzzy on what worked and what didn't. Can we set up a test dandiset or something where we can conduct an exact repro (without messing around with otherwise live dandisets)?

@yarikoptic
Copy link
Member Author

I gave above a specific example

image

So it is dandiset 000029 on the main instance even which we have for such purposes. https://dandiarchive.org/dandiset/000029 says "Test dataset for development purposes". Try to rename that bar-renamed, the asset e4032a47-141d-4c4c-84c1-2be3ac5aeb33 to bar-renamed3.

@dandibot
Copy link
Member

dandibot commented Oct 4, 2023

🚀 Issue was released in v0.3.55 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants