script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Pass an uploaded file to be processed in parameters script

Open adripalu opened this issue 11 months ago • 0 comments

Hi, Maybe I'm just missing something but... is it possible to create a multiselect list with a script that takes the uploaded file as input ?
I'll try to explain it better.
What I want is that after I've uploaded the file in the GUI, the second parameter (IDs) is defined dynamically thanks to the /local_path/create-list-from-excel.sh script, that executes a docker that run a python script that creates a file called kits.txt containing the list of IDs. Once this file is created, the IDs can be selected as parameters in the GUI before running the /local_path/some-script.sh.

This is an example of the json file:

{
    "name": "Select IDs",
    "script_path": "bash /local_path/some-script.sh",
    "parameters": [
        {
            "name" : "BATCH",
            "type" : "file_upload",
            "required" : true
        },
        {
            "name" : "IDs",
            "type" : "multiselect",
            "values" : {
                "script": "bash /local_path/create-list-from-excel.sh ${BATCH}"
            }
        }
    ]
}

The create-list-from-excel.sh is something like this:

#!/bin/bash
BATCH=$1

FILE=$(basename "${BATCH}")
cp "${BATCH}" /local_path/

docker run -v /local_path/:/cont_path/ --entrypoint "python" -ti operations_setup:0.1 get_ID_list.py "/cont_path/${FILE}"

cat /local_path/kits.txt

Thanks

adripalu avatar Feb 06 '25 16:02 adripalu