Closed adamkewley closed 4 years ago
Alright, so the first step of this feature is now in this PR. Video of it in action here:
Needs documenting, hardening, etc., but it seems to mostly be working. I can ship this intermediate product as an undocumented (and, therefore, not "officially" supported - yet) feature, because shipping new versions of Jobson is quite easy (usually automated by travis).
Jobson 1.0.9
now includes the file
support as an undocumented-but-working feature:
This PR now houses implementing file[]
support, which I've mostly done in the backend now, but it needs a relevant renderer in the UI (if you try it now, the UI will complain that it doesn't know what a file[]
is).
The latest commit now has both backend and UI support for the file[]
type. This implementation is a bit rough-and-ready (time constraints) but does work, mostly. Key points:
file[]
type as an expectedInput
<input type="file" multiple />
input as a consequence{
"spec": "specId",
"inputs": {
"inputId": [
{ "filename": "somefile.txt", "data": "<base64 string>" },
{ "filename": "someotherfile", "data": "<base 64 string>" }
]
}
}
Backend accepts the JSON request and converts it (internally) back into a byte array + filename. Developers can then use toDir
to put all of the files in into a single dir (duplicates are renamed accordingly):
# spec.yml
name: somespec
expectedInputs:
- id: filearray
type: file[]
execution:
application: echo
arguments:
- "${toDir(inputs.filearray)}"
- "${inputs.filearray}" # coerces into 'toDir(inputs.filearray)'
Which will give the runtime application a directory that it can then scan (e.g. with whatever directory listing function their language provides) to grab all inputs.
<input type="file" />
from javascriptdefault:
arg for both file
and file[]
inputs will not populate the UI with the default on first loading--demo
)Even with those problems/limitations in mind, I still think it would be a good idea to ship this as an undocumented feature. It's probably better to try this out and get the ball rolling than me spending weeks dealing with all this extra stuff. For developers using Jobson in smaller, closed deployments (e.g. research groups). They'll appreciate a somewhat-working feature today more than a perfect feature in acouple of months' time.
Asked for via email by a software developer who wants to use jobson to make a web interface for a bioinformatics tool.
Things needed (+ engineering considerations):
.fasta
files)string[]
input which, because of the various Gaia optimizations, does allow quite large inputs (e.g. I was uploading 100k+-elements via the UI at one point with no problems).fastq.gz
files) can work also,file
types also will enable larger (multi-megabyte, at least) inputs because the UI can skip javascript trying to parse the input as a string array${toDirContainingFiles(filesInput)}
) to handle the fact that the number of arguments passed to the application is currently staticapplication: arguments: []
. Ideally, this feature would also benefit from Jobson supporting runtime-determined number of arguments (because one use-case is to passapp file1 file2 ... filen
to the underlying app)Rough Tasklist
file
type in the backend, so that users can specifytype: file
in a job spec{ filename: Optional<string>, data: string }
, wheredata
is a b64-encoded data stringfile
type in frontend, so that UI users can upload a file via the UI (which uses thefile
-generated API added to the backend)File
input support, which supports users selecting files on their local computerfile[]
type in backend, so that users can specifytype: file[]
in job spec[{ filename: Optional<string>, data: string }]
type, similar to abovefile[]
type in frontendFile
input support, as abovesupportedExtensions
in the job specmaxSize
in the job spec