-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
standards for wrapping the command line client #4
Comments
Thanks for kickstarting this discussion! In terms of high level design philosophy for CWL, I like this comment from John Pellman's blog post:
I think this has a view implications:
For example/reference, if one were to create a CWL tool for (generating CWL from `argparse` — detailed steps)Create a conda environment:
Install the Synapse client and CWL:
Clone and install argparse2tool:
Modify the
import argparse
import os
import collections
import sys
import synapseclient
import synapseutils
- from . import Activity
+ from synapseclient.activity import Activity
import signal
import json
- from .exceptions import *
+ from synapseclient.exceptions import *
- from .wiki import Wiki
+ from synapseclient.wiki import Wiki Run the following command to generate CWL:
(see the argparse2tool repo for more info and options) ... here's what you get (note: outputs would need to be specified subsequently): inputs:
queryString:
type: ["null", string]
doc: Optional query parameter, will fetch all of the entities returned by a query (see query for help).
inputBinding:
prefix: --query
version:
type: ["null", int]
doc: Synapse version number of entity to retrieve. Defaults to most recent version.
inputBinding:
prefix: --version
recursive:
type: ["null", boolean]
default: False
doc: Fetches content in Synapse recursively contained in the parentId specified by id.
inputBinding:
prefix: --recursive
followLink:
type: ["null", boolean]
default: False
doc: Determines whether the link returns the target Entity.
inputBinding:
prefix: --followLink
limitSearch:
type: ["null", string]
doc: Synapse ID of a container such as project or folder to limit search for files if using a path.
inputBinding:
prefix: --limitSearch
downloadLocation:
type: ["null", string]
default: ./
doc: Directory to download file to [default - %(default)s].
inputBinding:
prefix: --downloadLocation
id:
type: ["null", string]
doc: Synapse ID of form syn123 of desired data object.
inputBinding:
position: 1
outputs:
[] That seems like a pretty decent scope to me. Part of the reason that @thomasyu888 and I originally added the wrapper shell script was because, at the time, there wasn't an option to specify a path for your Synapse config file (i.e., it had to be saved at For what it's worth, I think it would ultimately make more sense to generate our CWL "interface" based on the API specification (not the client) — but I'm not sure what tooling exists around this. As to @kdaily's thoughts:
I certainly think "best practice" for writing CWL tools should be to include the tagged version of a specific docker container (e.g.,
For today, because it's currently an accepted option for the CLI, I think we can just provide it with a corresponding parameter and binding. That said, I realized the
... so we might want to add those. We could be slightly opinionated though, and opt not to support user/password. For longer term handling of credentials, I elect to punt for now.
This is probably more subjective — distinguishing between what should be considered a "module" or "operation" vs. a specific option or parameter thereof. For the Synapse client, I don't think we need to get more granular than the top level commands.
Agreed. If we think of the CWL tools as "clients of the client" we can think about structuring tests in a similar way: the job of the tool is to form "inputs" and handle "outputs" correctly. It'd be great to discuss what these tests might look like in practice. |
so, where does this leave us? |
We have a handful of implementations on wrappers to upload and download from Synapse in a workflow. Given this is such a fundamental piece, we have the opportunity to be very intentional about how we do it. The command line client provides a natural place for this kind of work to happen in a workflow. We should discuss the pros and cons of how to wrap the command line client in CWL tools.
https://github.com/GA4GH-DREAM/dockstore-tool-synapse-get is really nice, but uses a separate shell script to parse options.
https://github.com/Sage-Bionetworks/Andrew_cwl_workflows/tree/master/utils/python_synapse_client has most implemented, but with a different command line interface than the actual command line client; relies on it's own docker file too.
https://github.com/Sage-Bionetworks/ChallengeWorkflowTemplates/blob/master/download_from_synapse.cwl - similar to the above
Some thoughts:
synapse get -q
as a separate tool, or use the above method for writing a shell wrapper to parse the arguments?)The text was updated successfully, but these errors were encountered: