Giter Club home page Giter Club logo

slicer_package_manager's Introduction

slicer_package_manager's People

Contributors

jcfr avatar zachmullen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jcfr

slicer_package_manager's Issues

Add EXTENSION_PACKAGE_TEMPLATE_NAME metadata

Rename the PACKAGE_TEMPLATE_NAME into APPLICATION_PACKAGE_TEMPLATE_NAME
this will avoid confusion between the revision of the application package (app_revision) with the revision on the extension

Review what would need to be changed to download.slicer.org

The front end for presenting Slicer packages is https://download.slicer.org/

The associated code can be found here: https://github.com/mhalle/slicer4-download

Step 1: API update

Update slicer4-download so that it can work with the API of the slicer_package_manager server.

cc: @Pierre-Assemat

@mhalle: Would it be possible to setup a test-download.slicer.org that we could update our-self to test ?

Step 2: Stats

Investigate how we could also keep track of more sophisticated stats for extension packages

The download.slicer.org currently takes care of generating the download stats: https://download.slicer.org/download-stats/

The download stats are first gathered by parsing the Apache log and keeping track of the results in a local sqlite database. It also look the stats can be exported to json.

@mhalle We would like to also support similar stats for the new extensions infrastructure. We were thinking to generalize your work and keep track of stats for both application packages and extension packages.

"docker-compose up" failures associated with girder "2.x-maintenance" branch

The following error is reported:

$ git clone --branch 2.x-maintenance https://github.com/girder/girder.git girder-2x
$ cd girder-2x
$ docker-compose up
[...]
ERROR: Could not find a version that satisfies the requirement hachoir-metadata (from girder==2.5.0) (from versions: none)
ERROR: No matching distribution found for hachoir-metadata (from girder==2.5.0)

Python client: Sort extension by date

We want to be able to sort extensions by date from the more recent one to the last.
Using the Girder API give us the sorted list of extension, but using the shell commands don't...

Add endpoint to support direct download of specific package or extension

Is your feature request related to a problem? Please describe.

Downloading a specific package without using the python client currently requires multiple calls. This lead to complex implementation.

For example:

# Get app_id
app_id=$(curl -X GET --header "Accept: application/json" "https://slicer-packages.kitware.com/api/v1/app?name=Slicer" | jq ".[0]._id" -r)
https://slicer-packages.kitware.com/api/v1/app?name=Slicer

app_id=5f4474d0e1d8c75dfc705482
echo "app_id: ${app_id}"

# Get item_id
revision=29917
os=macosx
arch=amd64
item_id=$(curl -X GET --header "Accept: application/json" "https://slicer-packages.kitware.com/api/v1/app/${app_id}/package?os=${os}&arch=${arch}&revision=${revision}" -s | jq ".[0]._id" -r)
echo "item_id: ${item_id}"

# Get file_id
curl -X GET "https://slicer-packages.kitware.com/api/v1/item/${item_id}/download" -O

Describe the solution you'd like

Add new endpoints.

There are few possible approaches to define the routes

Explicitly include release_id_or_name, os, arch, revision

For example:

GET /app/:app_id_or_name/:release_id_or_name/package/:os/:arch/:revision/download
GET /app/:app_id_or_name/:release_id_or_name/extension/:os/:arch/:revision/download

where:

  • app_id_or_name: 5f4474d0e1d8c75dfc705482 or Slicer
  • release_id_or_name: draft, release name like 4.10, or id of the release
  • os: linux, macosx or `win
  • arch: amd64
  • revision: 29917

Examples:

/app/Slicer/4.15/package/macosx/amd64/29917/download
/app/Slicer/draft/package/macosx/amd64/29917/download

Only with os, arch, revision

GET /app/:app_id_or_name/package/:os/:arch/:revision/download
GET /app/:app_id_or_name/extension/:os/:arch/:revision/download

and then additional parameter would be passed using &param1=value1.

All filters as parameters

GET /app/:app_id_or_name/package/download
GET /app/:app_id_or_name/extension/download

If more than packages is found, report an error requesting user to be more specific with specific filters.

Improve cleanNightly.sh

  • Do not display API key
  • Display text before listing list of revision to delete
  • Instead of --force use -y. I think it convey better the idea of answering yes to the question

Get extensions by Date and revisions

Get extensions older/newer than a specific date or revision.

First: by date

The basic use of the client should approaching the following command:

slicer_extension_manager_client extension get {app_name} --older {date} --newer {date}

Then: Link the revision with date of upload of the extension

We should be able to get only the extensions older/newer than a given revision.

slicer_extension_manager_client extension get {app_name} --older {app_revision} --newer {app_revision}

Consolidate the API endpoint to remove few of them

We should only use:

  • getExtensions
  • getReleases

To get both extension and release by name/id or a list of them. So we should remove:

  • get /app/{app_id}/extension/{extension_name}
  • get /app/{app_id}/release/{release_id_or_name}

And remove or rename with maybe /revisions instead of /draftrelease

  • get /app/{app_id}/release/draftrelease

Because it's function is to literally get all the revisions (as sub-folder of the 'draft' release) that contain the nightly extensions...

Docs: Update overview on the front page

instead of

The Slicer Package Manager is a Girder plugin that allows you to manage Slicer package
 and extension within Girder. It provides a simple API to Upload and Download extensions 
or packages, create new applications, and manage releases of your applications.

consider something like this where you would link to the different part of the documentation you already wrote:


The Slicer Package Manager includes a Girder plugin and a CLI allowing you
to manage Slicer packages for Slicer-based applications and associated extensions.

In a nutshell:

  • Data model specific to this project is implemented by organizing data using standard
    Girder constructs (collection, folder and item) and by associating metadata.

  • By default, a top-level collection named Applications is created with a packages folder
    organizing the different application.

  • Each application folder contain a draft folder where unreleased packages are uploaded and one or multiple release folders (e.g 1.0, 2.0, ...).

  • Each release folder contain application packages (installers for the different platforms), and an extensions folder containing a flat list of extension packages.

  • Each extension packages is associated with metadata like application revision, extension revision, operating system and architecture,

The diagram below represents the organization:

Applications
   |--- packages
   |        |----- Slicer
   |        |         |----- 1.0
   |        |         |        |---- Slicer-linux.tar.gz
   |        |         |        |---- Slicer-macos.dmg
   |        |         |        |---- Slicer-win.exe
   |        |         |        |---- extensions
   |        |         |        |             |---- Plugin1
   |        |         |        |             |---- Plugin1
   |        |         |        |             |---- Plugin1
   |        |         |        |             |---- Plugin2
   .        .         .        .             .
   .        .         .        . 
   |        |         |----- 2.0
   .        .         .        .
   .        .         .        
   |        |         |----- draft
   |        |         |        |--- r100
   |        |         |        |        |---- Slicer-linux.tar.gz
   |        |         |        |        |---- Slicer-macos.dmg
   |        |         |        |        |---- Slicer-win.exe
   |        |         |        |        |----- extensions
   |        |         |        |        |             |---- Plugin1
   .        .         .        .        .             .
   .        .         .        . 
   |        |         |        |--- r101
   .        .         .        .       |
   .        .         .        .
   |        |            
   |        |------SlicerCustom

Bug: Using `listRelease` in the pythonClient has weird behavior

This function return two different results when we try to find a specific release by name:

  • listRelease('nightly') will return the list of all revision containing in the default release folder (named 'nightly')

  • listRelease('Nightly') will return the 'nightly' folder...
    Or in the source code both of this command request the same endpoint :
    GET: app/{app_id}/release/{release_id_or_name}

But using the web interface of the server API, the two call with both Nightly & nightly parameters return the same response : the 'nightly' folder

Mark "releases" end-point as public

@autoDescribeRoute(
Description('Get all the releases from an application.')
.responseClass('Folder')
.param('app_id', 'The application\'s ID.', paramType='path')
.param('release_id_or_name', 'The release\'s ID or name.', required=False)
.pagingParams(defaultSort='created', defaultSortDir=SortDir.DESCENDING)
.errorResponse('ID was invalid.')
.errorResponse('Read permission denied on the application.', 403)
)
@access.user(scope=TokenScope.DATA_READ)
def getReleases(self, app_id, release_id_or_name, limit, offset, sort):

Application stable release should have additional properties: pre-release/release, unsigned/signed

This should help address https://issues.slicer.org/view.php?id=4296

I am not sure if we need both. To move the discussion forward, I will try to explain:

On windows, after generating stable release, the package is automatically uploaded to the server.

  • but it is not yet ready to be distributed to the user.
  • the package needs to be signed. This is currently a manual process, first download from the server, sign and .. then re-upload.

In the current Midas based system, the build system first upload the stable release as an "experimental" package. Then, we manually download, sign... and re-upload. See https://www.slicer.org/wiki/Documentation/Nightly/Developers/ReleaseProcess#Manually_sign_packages

If needed, we can also use some SQL to explicit tag a package as "release". See https://www.slicer.org/wiki/Documentation/Nightly/Developers/ReleaseProcess#Explicit_tagging_of_release_packages

Ideally, the API and the client should update the different "state" of the stable release. Before implementing, we need to identify these states.

Add support for managing "application" packages

Data Structure

Ideally the structure would look like this:

<Name of a collection>
  |
  |--------- packages
  |             |---- Slicer
  |             |       |
  |             |      4.8.1
  |             |         |----- Slicer-4.8.1-linux-amd64.tar.gz
  |             |         |----- Slicer-4.8.1-macos-amd64.dmg
  |             |         |----- Slicer-4.8.1-win-amd64.exe
  |             |         |----- extensions
  |             |         |             |--------- ext1
  |             |         |             [...]
  |             |      nightly
  |             |         |---- r1000
  |             |         |          |--------- [...]
  |             |         |---- r1042
  |             |                    |----- Slicer-4.9.1-2018-02-29-linux-amd64.tar.gz
  |             |                    |----- Slicer-4.9.1-2018-02-29-macos-amd64.dmg
  |             |                    |----- Slicer-4.9.1-2018-02-29-win-amd64.exe
  |             |                    |----- extensions
  |             |                            |--------- ext1
  |             |                            [...]
  |             | 
  |             |---- SlicerCustom1
  |
  |
  |--------- other unrelated folder

Download stats

Download stats currently stored as metadata under each "releases" (4.8.1, nightly, ...) and should be updated to also contain the download stats of the application package:

{
    "26953": {
        "applications": {
            "linux": {
                "amd64": 1
            },
            "macosx": {
                "amd64": 1
            }
        },
        "extensions": {
            "CardiacAgatstonMeasures": {
                "macosx": {
                    "amd64": 1
                }
            },
            "DebuggingTools": {
                "macosx": {
                    "amd64": 1
                }
            }
        }
    },
    "26962": {
        "applications": {
        },
        "extensions": {
            "Autoscroll": {
                "macosx": {
                    "amd64": 1
                }
            },
            "EasyClip": {
                "macosx": {
                    "amd64": 1
                }
            }
        }
    }
}

API

get /app/{app_id}/package 
delete /app/{app_id}/package/${package_id} 
post /app/{app_id}/package 

Add or update endpoint to support searching extensions by text

Features

For a given set of app_revision, os and arch, user should be able to easily search extension by text.

Text should be looked up within the following metadata fields:

baseName
description

Questions

(a) How to implement autocomplete in web app backed by Girder 3 API endpoint ?

(b) Is there any existing implementation that could re-use or adapt from ? (ansible, config, end-point implementation, ....)

(c) Current plan is to experiment with option (5) and (3) described below.

Known MongoDB Limitations

  • Using the built-in $text: {$search: 'sometext'} does not allow to implement search using arbitrary text as it is word based.

Options

In the context of the Slicer Extensions Manager migration where we are transitioning from my Midas to Girder for the backend, we have a Girder3 plugin called 1 2 3.

The autocomplete capabilities associated with the Midas instance is implemented leveraging LIKE SQL operator. It allowed us to quickly display relevant extensions while the user was typing text in a search box.

See https://github.com/midasplatform/slicerpackages/blob/5c4c6cabd391609c57b4d2c4d06fc11658c8ebd5/models/pdo/ExtensionModel.php#L36-L73

This feature is important, and we have been exploring how to implement this using Girder 3.

Few options:
(1) Allocate funding for a MongoDB Atlas instance. See https://docs.atlas.mongodb.com/reference/atlas-search/autocomplete/ (btw $500 to $1000 / year)
(2) On premise install of Solr with use of mongodb connector 4.
(3) On premise install of Elasaticsearch with use of the mongdb connector "monstache" implemented in go 5 6.
(4) On premise custom map/reduce job for extracting and updating collection to maintain map to original object7
(5) Simulate use of LIKE using regular expression8

References

Footnotes

  1. https://slicer-packages.kitware.com/#collection/5f4474d0e1d8c75dfc70547e/folder/60ff9291266e4e7d3a596236

  2. https://slicer-package-manager.readthedocs.io

  3. https://github.com/girder/slicer_package_manager

  4. https://blog.toadworld.com/2017/02/03/indexing-mongodb-data-in-apache-solr

  5. https://github.com/rwynn/monstache#readme

  6. https://rwynn.github.io/monstache-site/

  7. https://stackoverflow.com/questions/29892947/implement-auto-complete-feature-using-mongodb-search/29903429#29903429

  8. https://stackoverflow.com/questions/3305561/how-to-query-mongodb-with-like

cli: Command "extension list <appName>" should also list release name and app revision

For example:

EXTENSION ID             	NAME                          		REVISION    RELEASE NAME    APP REVISION  
-------------------------	------------------------------		--------    ------------    ------------
5aa008503b94df000180b499 	macosx_amd64_mpReview_1bf2be5 		 1bf2be5    draft           r20050
5aa0084e3b94df000180b496 	macosx_amd64_iGyne_a57c534    		 a57c534    draft           r20000
5aa0084c3b94df000180b493 	macosx_amd64_exStone_c71cd38  		 c71cd38    4.8.1           r19000   
5aa0084a3b94df000180b490 	macosx_amd64_ZFrameReg_28d43dd	         28d43dd    draft           r18500

[...]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.