ChRIS_ui icon indicating copy to clipboard operation
ChRIS_ui copied to clipboard

Export pipeline as JSON feature

Open jennydaman opened this issue 3 years ago • 8 comments

Feed view should have a button "Export" which creates a JSON representation of the selected DS plugins as part of a reproducible workflow, aka pipeline. This JSON file can be uploaded to the ChRIS store via POST request. Example:

https://github.com/FNNDSC/CHRIS_docs/blob/master/pipelines/fetal_brain_reconstruction.sh

A corresponding feature in ChRIS_store_ui is supporting import of these JSON representations of pipelines. https://github.com/FNNDSC/ChRIS_store_ui/issues/224

There should already exist an API endpoint which, given a plugin instance ID, saves a snapshot of the plugin instance and its children as a pipeline. Essentially we just need to connect this endpoint to a button.

jennydaman avatar Jun 17 '21 17:06 jennydaman

Ideas for iteration: MVP: select one plugin, it and all its children are saved as a plugin.

Reach goal: allow selection of multiple plugins, assert selections represent a DAG, and save that.

jennydaman avatar Jun 18 '21 13:06 jennydaman

@sonylomo still you are working on this if not can you pass this issue to me @jennydaman

alsoarpit avatar Mar 31 '22 03:03 alsoarpit

@arpit-maurya glad to see you're willing to take this up!

The original issue proposed an export to JSON feature. If you would like to take it above-and-beyond, try YAML output instead. Schema: https://github.com/FNNDSC/CHRIS_docs/blob/master/rfcs/2-pipeline_yaml.adoc

I'm sure you'll have questions about the spec, so please message me on Matrix.

jennydaman avatar Apr 05 '22 18:04 jennydaman

@arpit-maurya can I assist with this issue in any way, please let me know.

Anirudh4583 avatar Apr 14 '22 06:04 Anirudh4583

Hello @jennydaman, I'm an Outreachy intern candidate and was wondering if this would be a good issue to work on for my initial contribution.

oryxwhite avatar Oct 12 '22 00:10 oryxwhite

@oryxwhite this would be a great issue, I have assigned you.

jennydaman avatar Oct 14 '22 10:10 jennydaman

@jennydaman could you point me towards the endpoint you mentioned that generates a snapshot of the plugin and its children? I've been looking through the API and haven't been able to find it.

oryxwhite avatar Nov 15 '22 17:11 oryxwhite

@oryxwhite

POST /api/v1/pipelines/ HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, br
Authorization: Basic Y2hyaXM6Y2hyaXMxMjM0
Connection: keep-alive
Content-Length: 36
Content-Type: application/json
Host: localhost:8000
User-Agent: xh/0.17.0

{
    "plugin_inst_id": "2",
    "name": "lol1"
}




HTTP/1.1 201 Created
Allow: GET, POST
Connection: Keep-Alive
Content-Length: 600
Content-Type: application/json
Cross-Origin-Opener-Policy: same-origin
Date: Thu, 17 Nov 2022 06:04:41 GMT
Keep-Alive: timeout=2, max=100
Location: http://localhost:8000/api/v1/pipelines/2/
Referrer-Policy: same-origin
Server: Apache
Vary: Accept,Origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

{
    "url": "http://localhost:8000/api/v1/pipelines/2/",
    "id": 2,
    "name": "lol1",
    "locked": true,
    "authors": "",
    "category": "",
    "description": "",
    "owner_username": "chris",
    "creation_date": "2022-11-17T01:04:41.295425-05:00",
    "modification_date": "2022-11-17T01:04:41.295439-05:00",
    "plugins": "http://localhost:8000/api/v1/pipelines/2/plugins/",
    "plugin_pipings": "http://localhost:8000/api/v1/pipelines/2/pipings/",
    "default_parameters": "http://localhost:8000/api/v1/pipelines/2/parameters/",
    "instances": "http://localhost:8000/api/v1/pipelines/2/instances/",
    "workflows": "http://localhost:8000/api/v1/pipelines/2/workflows/"
}

jennydaman avatar Nov 17 '22 06:11 jennydaman