fractal-analytics-platform / fractal-web

Web client for Fractal
https://fractal-analytics-platform.github.io/fractal-web/
BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

Parse whole task-package manifest, and show argument forms for tasks #513

Closed tcompa closed 2 days ago

tcompa commented 3 weeks ago

This is a placeholder issue, which will become relevant during/after #512.

Briefly: we could let the user upload a whole manifest (anything upload the file, paste the JSON text, point to an URL), parse it to extract the N tasks and their parallel/non-parallel schemas, and show e.g. a dropdown menu with all tasks. By selecting one, the user would see the corresponding form and values.

High-level: this would be quite useful for a user who built their package and wants to review the whole manifest (are tasks all there? do they look OK in the form? and so on..). The parsing of the manifest is quite simple, and based on this JSON Schema https://github.com/fractal-analytics-platform/fractal-server/blob/main/fractal_server/json_schemas/manifest_v2.json

tcompa commented 1 week ago
  1. User uploads manifest from disk
  2. TBD: we may add a validation step, where we validate the manifest against its schema.
  3. Verify that manifest_version="2", has_args_schemas=true, and args_schema_version="pydantic_v1".
  4. Construct list of task names, and expose it as a dropdown menu
  5. When the user picks task A, render the same page as for the single-schema sandbox, with the minor difference that we need to expose both non-parallel and parallel entries (if present). The dropdown menu remains visible on this page.
tcompa commented 1 week ago

Example manifest for testing: https://raw.githubusercontent.com/fractal-analytics-platform/fractal-tasks-core/main/fractal_tasks_core/__FRACTAL_MANIFEST__.json

zonia3000 commented 5 days ago

Screenshot of the new page:

image

Notice that I added to the repo a copy of the manifest JSON Schema (https://github.com/fractal-analytics-platform/fractal-server/blob/main/fractal_server/json_schemas/manifest_v2.json), since it is not possible to automatically include it in the page from GitHub. Using the <script> tag it is possible to load JavaScript files as remote resources, but not JSON files. I've tried also with a possible workaround using an <iframe>, but that is disallowed by a security header added by GitHub server (X-Frame-Options: DENY), so the only option is to have a local copy of it.

tcompa commented 5 days ago

First quick comment (cc @jluethi): should we stick with just supporting V2 manifests, rather than legacy/v2?

jluethi commented 4 days ago

That's awesome!

Let's stick with only v2 manifest for sure! We can just show an error if the manifest has an older version than V2 :)

This new manifest version is super powerful during local task development, as the whole manifest gets created by the dev tooling and can then just be uploaded. Can one drag & drop the manifest in there? [if that's tricky to implement, not critical]

zonia3000 commented 3 days ago

I've added a drag and drop area for the manifest file:

image

jluethi commented 3 days ago

That's awesome! Will make for a neat demo! :) 👏🏻