Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded `delete_tileset` manage command and `tileset` API route #79
Conversation
Nov 13, 2018
and others
added some commits
This comment has been minimized.
This comment has been minimized.
I added a management command and API route to modify a tileset's properties by Here is an example management command:
And here is an example API call:
|
alexpreynolds
and others
added some commits
Nov 13, 2018
This comment has been minimized.
This comment has been minimized.
This is great! Thanks Alex. A few things before merging:
Thanks! |
pkerpedjiev
requested changes
Nov 13, 2018
@@ -492,6 +494,95 @@ def tiles(request): | |||
) | |||
|
|||
return JsonResponse(tiles_to_return, safe=False) | |||
|
|||
|
|||
@api_view(['POST', 'DELETE']) |
This comment has been minimized.
This comment has been minimized.
pkerpedjiev
Nov 13, 2018
Contributor
Did you check if the curl -X 'DELETE' server:port/api/v1/tilesets/[uuid]/
endpoint already exists? There's already a tilesets viewset that should provide, GET, POST, UPDATE, DELETE endpoints here:
higlass-server/tilesets/views.py
Line 683 in dc4d380
I know the POST endpoint works because I've been using it to upload datasets to higlass.io. Take a look here: http://docs-dev.higlass.io/data_preparation.html#importing-into-higlass
If possible, I'd prefer to avoid duplicating API endpoints.
@@ -55,6 +55,34 @@ curl http://localhost:8000/api/v1/tileset_info/?d=hitile-demo | |||
curl http://localhost:8000/api/v1/tiles/?d=hitile-demo.0.0.0 | |||
``` | |||
|
|||
## Preparing files for ingest |
This comment has been minimized.
This comment has been minimized.
pkerpedjiev
Nov 13, 2018
Contributor
All of the datatype specific documentation is in the main documentation repository: http://docs-dev.higlass.io/data_preparation.html
The code for that can be found here: https://github.com/higlass/higlass/tree/develop/docs
@@ -1,8 +1,8 @@ | |||
Cython==0.25.2 | |||
-e git+https://github.com/mirnylab/cooler.git@master#egg=cooler |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sorry. I'm going to close this PR and start over. |
alexpreynolds
closed this
Nov 15, 2018
This comment has been minimized.
This comment has been minimized.
No, it's my fault that we don't have better documentation about the API endpoints. Ideally the docs would have a section on the REST API. Without looking at the code it's nearly impossible to figure out what endpoints exist and how to access them. All this is to say, your PR is really appreciated and hopefully it's not too much work to fit it into TilesetViewSet. |
This comment has been minimized.
This comment has been minimized.
I neglected to sync my fork with upstream, so starting over was necessary, anyway. Looks like the built-in DELETE does remove the database entry, but it does not remove the tileset file from the media/uploads directory. I'll look at overriding the behavior of the |
alexpreynolds commentedNov 13, 2018
•
edited
Here is a demonstration tileset:
Here is an example showing the use of the
manage.py delete_tileset
command to remove this tileset file and database record:The API call uses the
DELETE
method and theIsAuthenticated
permission class decorator, which requires authentication. Here is an example of an (unauthenticated) API call:The API returns 40x errors if the underlying instance or file is not found or cannot be removed.
For debugging purposes, I modified the
Tileset
model__str__
function to return the tileset'suuid
along with itsname
andfiletype
properties.