コード例 #1
0
    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # if -f, use as body; otherwise build body from inputs
    if args.description_file is not None:
        body_contents = vdjpy.read_json(args.description_file)
        if body_contents is None:
            sys.exit('Not a valid file path or does not contain a valid notification description.')
        kwargs['body'] = json.dumps(body_contents)

    else:
        # -e
        if args.email_or_url is None:
            args.email_or_url = vdjpy.prompt_user('email or url')
        
        # -a
        if args.associated_uuid is None:
            args.associated_uuid = vdjpy.prompt_user('associated uuid')
   
        # -p
        persistent = 'false'
        if args.persistent:
            persistent = 'true'
  
        kwargs['body'] = "{\"url\": \"" + args.email_or_url + "\", \"event\": \"*\", \"associatedUuid\": \"" + args.associated_uuid + "\", \"persistent\": " + persistent + "}"

    # update notification if args.notification_uuid; otherwise create new
    if args.notification_uuid is not '':
        if args.notification_uuid is None:
コード例 #2
0
ファイル: files-move.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(description = 'Move a file from one location to another on a remote system. System defaults to data.vdjserver.org. This command does not update metadata. If you wish the effects of this command to be visible on vdjserver.org, use the vdj files move command.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', default = 'data.vdjserver.org', nargs = '?', help = 'system ID')
    parser.add_argument('-p', '--path', dest = 'path', nargs = '?', help = 'path to file to be moved')
    parser.add_argument('-d', '--destination', dest = 'destination', nargs = '?', help = 'path to file\'s destination. Include the file name at the end of the path.')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system')
    kwargs['systemId'] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user('path')
    kwargs['filePath'] = args.path

    # -d
    if args.destination is None:
        args.destination = vdjpy.prompt_user('destination of the file')
    kwargs['body']  = {'action': 'move', 'path': args.destination}

    # move file
    move = my_agave.files.manage(**kwargs)
コード例 #3
0
ファイル: jobs-resubmit.py プロジェクト: jturcino/vdj-cli
if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'Resubmit a job. Original inputs and parameters are used and a new jobID is assigned.')
    parser.add_argument('-j', '--jobID', dest = 'jobID', default = None, nargs = '?', help = 'job ID')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}
    kwargs['body'] = {'action': 'resubmit'}

    # -j
    if args.jobID is None:
        args.jobID = vdjpy.prompt_user('job ID')
    kwargs['jobId'] = args.jobID

    # resubmit job
    resubmit = my_agave.jobs.manage(**kwargs)


    # if -v
    if args.verbose:
        print json.dumps(resubmit, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))

    # if no -v
    else:
        print 'Now resubmitting job', resubmit['name'], '\nid:', resubmit['id'], '\nstatus:', resubmit['status']
コード例 #4
0
    parser.add_argument('-f', '--file_name', dest = 'file_name', default = '', nargs = '?', help = 'name of projectfile')
    parser.add_argument('-j', '--jobfile_name', dest = 'jobfile_name', default = '', nargs = '?', help = 'name of jobfile')
    parser.add_argument('-l', '--limit', dest = 'limit', default = 250, type = int, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', default = 0, type = int, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make Agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}
    kwargs['systemId'] = 'data.vdjserver.org'

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project')
    project_uuid = vdjpy.get_uuid(args.project, my_agave)
    if project_uuid is None:
        sys.exit()

    # -l
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit

    # -o
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer('offset', 0)
    kwargs['offset'] = args.offset

    # SET UP FILETYPE AND GET FILE NAME IN ARGS.FILE_NAME
コード例 #5
0
if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'Update metadata object permissions for a user. Permissions options are READ, WRITE, EXECUTE, READ_WRITE, READ_EXECUTE, WRITE_EXECUTE, ALL, or NONE.')
    parser.add_argument('-u', '--uuid', dest = 'uuid', nargs = '?', help = 'uuid of metadata object')
    parser.add_argument('-n', '--username', dest = 'username', nargs = '?', help = 'username to be updated')
    parser.add_argument('-p', '--permissions', dest = 'permissions', nargs = '?', help = 'permissions to grant to user')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -u
    if args.uuid is None:
        args.uuid = vdjpy.prompt_user('uuid of item')
    kwargs['uuid'] = args.uuid

    # -n
    if args.username is None:
        args.username = vdjpy.prompt_user('username')

    # -p
    if args.permissions is None:
        print 'Valid permission options are as follows: \n\tREAD \n\tWRITE \n\tEXECUTE \n\tREAD_WRITE \n\tREAD_EXECUTE \n\tWRITE_EXECUTE \n\tALL \n\tNONE'
        args.permissions = vdjpy.prompt_user('permissions')

    # build body
    kwargs['body'] = "{\n\t\"username\":\"" + args.username + "\",\n\t\"permission\": \"" + args.permissions + "\"\n}"

    # list permissions
コード例 #6
0
ファイル: apps-pems-list.py プロジェクト: jturcino/vdj-cli
if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'List user permissions for an app.')
    parser.add_argument('-a', '--appID', dest = 'appID', nargs = '?', help = 'application ID')
    parser.add_argument('-l', '--limit', dest = 'limit', default = 250, nargs = '?', type = int, help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', default = 0, nargs = '?', type = int, help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # check appID
    if args.appID is None:
        args.appID = vdjpy.prompt_user('app ID')
    kwargs['appId'] = args.appID

    # limit
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit

    # offset
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer('offset', 0)
    kwargs['offset'] = args.offset

    # get systems
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    pems_list = my_agave.apps.listPermissions(**kwargs)
コード例 #7
0
if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'List user permissions for a metadata object.')
    parser.add_argument('-u', '--uuid', dest = 'uuid', nargs = '?', help = 'uuid of metadata object')
    parser.add_argument('-l', '--limit', dest = 'limit', type = int, default = 250, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', type = int, default = 0, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -u
    if args.uuid is None:
        args.uuid = vdjpy.prompt_user('uuid of item')
    kwargs['uuid'] = args.uuid

    # -l
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit

    # -o
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer('offset', 0)
    kwargs['offset'] = args.offset

    # list permissions
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    pems_list = my_agave.meta.listMetadataPermissions(**kwargs)
コード例 #8
0
ファイル: metadata-delete.py プロジェクト: jturcino/vdj-cli
import argparse
import sys

if __name__ == "__main__":

    # arguments
    parser = argparse.ArgumentParser(description="Delete a metadata object.")
    parser.add_argument("-u", "--uuid", dest="uuid", nargs="?", help="uuid of metadata object")
    parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token")
    args = parser.parse_args()

    # make agave object and kwargs
    kwargs = {}
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)

    # -u
    if args.uuid is None:
        args.uuid = vdjpy.prompt_user("uuid of item")
    kwargs["uuid"] = args.uuid

    # delete metadata
    metadata_delete = my_agave.meta.deleteMetadata(**kwargs)

    # deliver message
    if metadata_delete is None:
        print "Successfully deleted metadata item", args.uuid
    else:
        print "Deletion was not successfull. The message returned from the request was:\n" + json.dumps(
            metadata_delete, default=vdjpy.json_serial, sort_keys=True, indent=4, separators=(",", ": ")
        )
コード例 #9
0
ファイル: postits-delete.py プロジェクト: jturcino/vdj-cli
#!/usr/bin/env python

import json
import argparse
import vdjpy

if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'Immediately expires a postit.')
    parser.add_argument('-n', '--nonce', dest = 'nonce', nargs = '?', help = 'nonce of the postit')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -n
    if args.nonce is None:
        args.nonce = vdjpy.prompt_user('nonce of postit')
    kwargs['nonce'] = args.nonce

    # delete postit
    postit_delete = my_agave.postits.delete(**kwargs)

    if postit_delete == {}:
        print 'successfully deleted postit', args.nonce
コード例 #10
0
ファイル: files-pems-list.py プロジェクト: jturcino/vdj-cli
    parser.add_argument("-p", "--path", dest="path", nargs="?", help="path to file")
    parser.add_argument(
        "-l", "--limit", dest="limit", default=250, type=int, nargs="?", help="maximum number of results return"
    )
    parser.add_argument(
        "-o", "--offset", dest="offset", default=0, type=int, nargs="?", help="number of results to skip from the start"
    )
    parser.add_argument("-v", "--verbose", dest="verbose", action="store_true", help="verbose output")
    parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token")
    args = parser.parse_args()

    kwargs = {}

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user("system")
    kwargs["systemId"] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user("path")
    kwargs["filePath"] = args.path

    # -l
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer("limit", 250)
    kwargs["limit"] = args.limit

    # -o
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer("offset", 0)
コード例 #11
0
ファイル: files-delete.py プロジェクト: jturcino/vdj-cli

if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'Delete a file on a remote system. System defaults to data.vdjserver.org. This command does not update metadata. If you wish the file to be removed from a project on vdjserver.org, use the vdj files delete command.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', default = 'data.vdjserver.org', nargs = '?', help = 'system ID')
    parser.add_argument('-p', '--path', dest = 'path', nargs = '?', help = 'path to file to be deleted')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system name')
    kwargs['systemId'] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user('path to the file')
    kwargs['filePath'] = args.path

    # delete file
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    files_delete = my_agave.files.delete(**kwargs)

    if files_delete is None:
        print 'Successfully deleted file at path', args.path
    else:
        print 'Deletion was not successfull. The message returned from the request was:\n' + json.dumps(files_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
コード例 #12
0
ファイル: vdj-files-upload.py プロジェクト: jturcino/vdj-cli
    parser.add_argument('-y', '--file_type', dest = 'file_type', default = '', nargs = '?', help = 'filetype of file to be uploaded')
    parser.add_argument('-r', '--read_direction', dest = 'read_direction', default = '', nargs = '?', help = 'read direction of genetic data. To be used for fasta/fastq files.')
    parser.add_argument('-t', '--tags', dest = 'tags', action = 'store_true', help = 'use to enter tags')
    parser.add_argument('-w', '--email_or_webhook', dest = 'email_or_webhook', default = '', nargs = '?', help = 'the email or webhook to notify upon completion')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # UPLOAD FILE SETUP
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}
    kwargs['systemId'] = 'data.vdjserver.org'

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project name')
    project_uuid = vdjpy.get_uuid(args.project, my_agave)
    if project_uuid is None:
        sys.exit('Could not find specified project')
    kwargs['filePath'] = vdjpy.build_vdj_path(project_uuid, '', 'projectFile', '')

    # -f
    if args.file_upload is None:
        args.file_upload = vdjpy.prompt_user('file to upload')
    kwargs['fileToUpload'] = open(args.file_upload)

    # -n
    if args.file_name is None:
        args.file_name = args.file_upload
    kwargs['fileName'] = args.file_name
コード例 #13
0
ファイル: metadata-list.py プロジェクト: jturcino/vdj-cli
    )
    parser.add_argument("-q", "--query", dest="query", type=str, nargs="?", help="query used to search metadata")
    parser.add_argument(
        "-l", "--limit", dest="limit", type=int, default=5000, nargs="?", help="maximum number of results to return"
    )
    parser.add_argument(
        "-o", "--offset", dest="offset", type=int, default=0, nargs="?", help="number of results to skip from the start"
    )
    parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token")
    args = parser.parse_args()

    kwargs = {}

    # -q
    if args.query is None:
        args.query = vdjpy.prompt_user("metadata query")
        args.query = re.sub(r"^\'|\'$", "", args.query)
    args.query = urllib.quote(args.query)
    kwargs["q"] = args.query

    # -l
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer("limit", 5000)
    kwargs["limit"] = args.limit

    # -o
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer("offset value", 0)
    kwargs["offset"] = args.offset

    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
コード例 #14
0
ファイル: vdj-files-rename.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(description = 'Rename a projectfile or jobfile on data.vdjserver.org. This command updates metadata, and the renamed file will be visible on vdjserver.org if it is a projectfile.')
    parser.add_argument('-p', '--project', dest = 'project', nargs = '?', help = 'name of the file\'s project')
    parser.add_argument('-f', '--file_name', dest = 'file_name', default = '', nargs = '?', help = 'name of projectfile')
    parser.add_argument('-j', '--jobfile_name', dest = 'jobfile_name', default = '', nargs = '?', help = 'name of jobfile')
    parser.add_argument('-n', '--new_name', dest = 'new_name', nargs = '?', help = 'new name of file')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object 
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project')
    uuid = vdjpy.get_uuid(args.project, my_agave)
    if uuid is None:
        sys.exit()

   # SET UP FILETYPE AND GET FILE NAME IN ARGS.FILE_NAME
    # -f (default)
    if args.file_name is not '' or args.jobfile_name is '':
	if args.file_name is None:
            args.file_name = vdjpy.prompt_user('current file name')
	filetype = 'projectFile'
    # -j (only used if specified)
    else:
	if args.jobfile_name is None:
	    args.jobfile_name = vdjpy.prompt_user('current jobfile name')
	filetype = 'projectJobFile'
コード例 #15
0
ファイル: jobs-pems-update.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(
        description="Update job permissions for a user. Permission options are READ, WRITE, EXECUTE, READ_WRITE, READ_EXECUTE, WRITE_EXECUTE, ALL, or NONE."
    )
    parser.add_argument("-j", "--jobID", dest="jobID", nargs="?", help="job ID")
    parser.add_argument("-u", "--username", dest="username", nargs="?", help="username to be updated")
    parser.add_argument("-p", "--permissions", dest="permissions", nargs="?", help="permissions to grant to user")
    parser.add_argument("-v", "--verbose", dest="verbose", action="store_true", help="verbose output")
    parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token")
    args = parser.parse_args()

    kwargs = {}

    # -j
    if args.jobID is None:
        args.jobID = vdjpy.prompt_user("jobID")
    kwargs["jobId"] = args.jobID

    # -u
    if args.username is None:
        args.username = vdjpy.prompt_user("username")

    # -p
    if args.permissions is None:
        print "Valid permission options are as follows: \n\tREAD \n\tWRITE \n\tEXECUTE \n\tREAD_WRITE \n\tREAD_EXECUTE \n\tWRITE_EXECUTE \n\tALL \n\tNONE"
        args.permissions = vdjpy.prompt_user("permission to set")

    # build body
    kwargs["body"] = '{\n\t"username":"******",\n\t"permission": "' + args.permissions + '"\n}'

    # update permissions
コード例 #16
0
ファイル: apps-list.py プロジェクト: jturcino/vdj-cli
    parser.add_argument('-p', '--publiconly', dest = 'publiconly', default = False, action = 'store_true', help = 'list only public apps')
    parser.add_argument('-q', '--privateonly', dest = 'privateonly', default = False, action = 'store_true', help = 'list only private apps')
    parser.add_argument('-l', '--limit', dest = 'limit', type = int, default = 250, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', type = int, default = 0, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # IF APPID, GET APP INFO, PRINT, AND EXIT
    if args.appID is not '':
	if args.appID is None:
	    args.appID = vdjpy.prompt_user('app ID')
	resp = my_agave.apps.get(appId = args.appID)
	print json.dumps(resp, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
	sys.exit()

    # IF NO APPID, LIST APPS
    # public/private
    if args.publiconly is True and args.privateonly is False:
        kwargs['publicOnly'] = args.publiconly
    elif args.privateonly is True and args.publiconly is False:
        kwargs['privateOnly'] = args.privateonly

    # limit
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit
コード例 #17
0
ファイル: vdj-files-list.py プロジェクト: jturcino/vdj-cli
    parser.add_argument('-l', '--limit', dest = 'limit', type = int, default = 5000, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', type = int, default = 0, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # cache and query
    projects_cache = './.vdjprojects'

    # make Agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project name')
    project_uuid = vdjpy.get_uuid(args.project, my_agave)
    if project_uuid is None:
        sys.exit()

    # -l (for listMetadata)
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 5000)
    kwargs['limit'] = args.limit

    # -o (for listMetadata)
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer('offset value', 0)
    kwargs['offset'] = args.offset

    # SET UP FILETYPE
コード例 #18
0
ファイル: vdj-files-delete.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(description = 'Delete a projectfile or jobfile on data.vdjserver.org. This command updates metadata, and the deleted file will no longer be visible on vdjserver.org.')
    parser.add_argument('-p', '--project', dest = 'project', nargs = '?', help = 'name of file\'s project')
    parser.add_argument('-f', '--file_to_delete', dest = 'file_to_delete', default = '', nargs = '?', help = 'name of projectfile')
    parser.add_argument('-j', '--jobfile_to_delete', dest = 'jobfile_to_delete', default = '', nargs = '?', help = 'name of jobfile')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project name')
    project_uuid = vdjpy.get_uuid(args.project, my_agave)
    if project_uuid is None:
        sys.exit()
    project_uuid = str(project_uuid)

    # SET UP FILETYPE AND GET FILE NAME IN ARGS.FILE_NAME
    # -f (default file type; used if -j not called)
    if args.file_to_delete is not '' or args.jobfile_to_delete is '':
	if args.file_to_delete is None:
            args.file_to_delete = vdjpy.prompt_user('file to delete')
	filetype = 'projectFile'
    # -j (only used if specified)
    else:
	if args.jobfile_to_delete is None:
	    args.jobfile_to_delte = vdjpy.prompt_user('jobfile to delete')
コード例 #19
0
ファイル: vdj-files-get.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(description = 'Download a projectfile or jobfile from data.vdjserver.org.')
    parser.add_argument('-p', '--project', dest = 'project', nargs = '?', help = 'name of the file\'s project')
    parser.add_argument('-f', '--file_name', dest = 'file_name', default = '', nargs = '?', help = 'name of projectfile')
    parser.add_argument('-j', '--jobfile_name', dest = 'jobfile_name', default = '', nargs = '?', help = 'name of jobfile')
    parser.add_argument('-n', '--newfile_name', dest = 'newfile_name', default = '', nargs = '?', help = 'name of the file once downloaded')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()
    
    # make Agave object 
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)

    # -p
    if args.project is None:
        args.project = vdjpy.prompt_user('project name')
    project_uuid = vdjpy.get_uuid(args.project, my_agave)
    if project_uuid is None:
        sys.exit('')

    # SET UP FILETYPE AND GET FILE NAME IN ARGS.FILE_NAME
    # -f (default)
    if args.file_name is not '' or args.jobfile_name is '':
        if args.file_name is None or '':
            args.file_name = vdjpy.prompt_user('file name')
        filetype = 'projectFile'
    # -j (only if flag given)
    else:
        if args.jobfile_name is None:
            args.jobfile_name = vdjpy.prompt_user('jobfile name')
        filetype = 'projectJobFile'
コード例 #20
0
ファイル: systems-delete.py プロジェクト: jturcino/vdj-cli
import argparse
import json
import os.path
import vdjpy

if __name__ == '__main__':
    
    # arguments
    parser = argparse.ArgumentParser(description = 'Delete a system. This deletes all applications registered to the system. Currently running jobs may fail to archive data if the archive system is deleted. Additionally, file transfers may fail if the transfer has not started when the system is deleted.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', nargs = '?', help = 'system ID')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -f
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system ID')
    kwargs['systemId'] = args.systemID
    
    # delete system
    system_delete = my_agave.systems.delete(**kwargs)

    # deliver message
    if system_delete is None:
        print 'Successfully deleted system', args.systemID
    else:
        print 'Deletion was not successfull. The message returned from the request was:\n' + json.dumps(system_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
コード例 #21
0
ファイル: files-upload.py プロジェクト: jturcino/vdj-cli
    parser.add_argument('-p', '--path', dest = 'path', nargs = '?', help = 'path to destination directory on remote system. Do not append the file name to the path.')
    parser.add_argument('-f', '--file_upload', dest = 'file_upload', nargs = '?', help = 'the file or directory to upload')
    parser.add_argument('-r', '--recursive', dest = 'recursive', action = 'store_true', help = 'upload file or directory recursively')
    parser.add_argument('-n', '--file_name', dest = 'file_name', nargs = '?', help = 'name of file once uploaded. File will retain original name if this flag is not used. Not supported in recursive file uploads.')
    parser.add_argument('-w', '--email_or_webhook', dest = 'email_or_webhook', default = '', nargs = '?', help = 'email or webhook to notify upon completion')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # UPLOAD FILE SETUP
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system ID')
    kwargs['systemId'] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user('destination path')
    kwargs['filePath'] = args.path

    # -f
    if args.file_upload is None:
        args.file_upload = vdjpy.prompt_user('file to upload')

    # open file for upload if not recursive; catch if user tries to upload directory
    if args.recursive is False:
        try:
            kwargs['fileToUpload'] = open(args.file_upload)
コード例 #22
0
ファイル: postits-create.py プロジェクト: jturcino/vdj-cli
    )
    parser.add_argument(
        "-a", "--no_auth", dest="no_auth", action="store_true", help="does not pre-authenticate the URL"
    )
    parser.add_argument("-v", "--verbose", dest="verbose", action="store_true", help="verbose output")
    parser.add_argument("-z", "--accesstoken", dest="accesstoken", nargs="?", help="access token")
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # if -f
    if args.description_file is not "":
        if args.description_file is None:
            args.description_file = vdjpy.prompt_user("path to description file")
        body_contents = vdjpy.read_json(args.description_file)
        if body_contents is None:
            sys.exit("Not a valid file path or does not contain a valid app description.")
        kwargs["body"] = json.dumps(body_contents)

    # else, build body
    else:
        # -u
        if args.url is None:
            args.url = vdjpy.prompt_user("url of postit")
        kwargs["body"] = '{"url": "' + args.url + '"'

        # -x
        if args.max_uses is None:
            args.max_uses = vdjpy.prompt_for_integer("max number of uses", 25)
コード例 #23
0
ファイル: apps-search.py プロジェクト: jturcino/vdj-cli
    parser = argparse.ArgumentParser(description = 'Search for apps based on attributes. Values must be in dictionary form such as {"executionSystem.like": "*stampede*"} or {"id.like": "vdj_pipe*"}.')
    parser.add_argument('-q', '--query', dest = 'query', nargs = '?', help = 'search query in dictionary form')
    parser.add_argument('-l', '--limit', dest = 'limit', type = int, default = 250, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', type = int, default = 0, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -q
    if args.query is None:
        print 'Queries must be in dictionary form. Some example queries are: \n\t{"executionSystem.like": "*stampede*"} \n\t{"id.like": "vdj_pipe*"}'
        args.query = vdjpy.prompt_user('search query')
    try:
        kwargs['search'] = ast.literal_eval(args.query)
    except:
        sys.exit('Given query is not a valid dictionary')

    # limit
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit

    # offset
    if args.offset is None:
        args.offset = vdjpy.prompt_for_integer('offset', 0)
    kwargs['offset'] = args.offset
コード例 #24
0
ファイル: files-pems-delete.py プロジェクト: jturcino/vdj-cli
import argparse

if __name__ == '__main__':
    
    # arguments
    parser = argparse.ArgumentParser(description = 'Delete permissions for a file or directory on a remote system. System defaults to data.vdjserver.org.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', default = 'data.vdjserver.org', nargs = '?', help = 'system ID')
    parser.add_argument('-p', '--path', dest = 'path', nargs = '?', help = 'path to file')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system')
    kwargs['systemId'] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user('path')
    kwargs['filePath'] = args.path

    # delete permissions
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    pems_delete = my_agave.files.deletePermissions(**kwargs)

    if pems_delete is None:
        print 'Succesfully removed permissions for file at path', args.path
    else:
        print 'Permission removal was not successfull. The message returned from the request was:\n' + json.dumps(pems_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
コード例 #25
0
    
    # arguments
    parser = argparse.ArgumentParser(description = 'List user roles on a system. Results can be filtered by username.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', nargs = '?', help = 'system ID')
    parser.add_argument('-u', '--username', dest = 'username', default = '', nargs = '?', help = 'user whose roles should be listed')
    parser.add_argument('-l', '--limit', dest = 'limit', type = int, default = 250, nargs = '?', help = 'maximum number of results to return')
    parser.add_argument('-o', '--offset', dest = 'offset', type = int, default = 0, nargs = '?', help = 'number of results to skip from the start')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # check systemID
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system ID')
    kwargs['systemId'] = args.systemID

    # check username
    if args.username is not '':
        if args.username is None:
            args.username = vdjpy.prompt_user('username')
        kwargs['username'] = args.username

    # -l
    if args.limit is None:
        args.limit = vdjpy.prompt_for_integer('limit', 250)
    kwargs['limit'] = args.limit

    # -o
    if args.offset is None:
コード例 #26
0
ファイル: apps-addupdate.py プロジェクト: jturcino/vdj-cli
    
    # arguments
    parser = argparse.ArgumentParser(description = 'Register a new application or update a current application. If the ID of an existing app is given, the app will be updated; otherwise, a new app will be created.')
    parser.add_argument('-a', '--appID', dest = 'appID', default = '', nargs = '?', help = 'application ID')
    parser.add_argument('-f', '--description_file', dest = 'description_file', nargs = '?', help = 'file containing JSON app description')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object and kwargs
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    kwargs = {}

    # -f
    if args.description_file is None:
        args.description_file = vdjpy.prompt_user('path to file containing app description')
    
    # open -f and use as body
    body_contents = vdjpy.read_json(args.description_file)
    if body_contents is None:
        sys.exit('Not a valid file path or does not contain a valid app description.')
    kwargs['body'] = json.dumps(body_contents)

    # if -a, update app
    if args.appID is not '':
	if args.appID is None:
            args.appID = vdjpy.prompt_user('app ID')
	kwargs['appId'] = args.appID
	resp = my_agave.apps.update(**kwargs)

    # else, add app
コード例 #27
0
#!/usr/bin/env python

import vdjpy
import json
import argparse

if __name__ == '__main__':
    
    # arguments
    parser = argparse.ArgumentParser(description = 'Delete metadata permissions for all users.')
    parser.add_argument('-u', '--uuid', dest = 'uuid', nargs = '?', help = 'uuid of metadata object')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -u
    if args.uuid is None:
        args.uuid = vdjpy.prompt_user('uuid')
    kwargs['uuid'] = args.uuid

    # delete permissions
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    pems_delete = my_agave.meta.deleteMetadataPermission(**kwargs)

    if pems_delete is None:
        print 'Succesfully removed permissions for metadata object', args.uuid
    else:
        print 'Permission removal was not successfull. The message returned from the request was:\n' + json.dumps(pems_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
コード例 #28
0
ファイル: vdj-files-move.py プロジェクト: jturcino/vdj-cli
    # arguments
    parser = argparse.ArgumentParser(description = 'Move a projectfile or jobfile from one location on data.vdjserver.org to a projectfile destination. This command updates metadata, and the moved file will be visible in its new location on vdjserver.org.')
    parser.add_argument('-p', '--current_project', dest = 'current_project', nargs = '?', help = 'name of the file\'s current project')
    parser.add_argument('-d', '--destination_project', dest = 'destination_project', nargs = '?', help = 'name of the file\'s destination project')
    parser.add_argument('-f', '--file_name', dest = 'file_name', default = '', nargs = '?', help = 'name of projecfile')
    parser.add_argument('-j', '--jobfile_name', dest = 'jobfile_name', default = '', nargs = '?', help = 'name of jobfile')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    # make agave object 
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)

    # -p
    if args.current_project is None:
        args.current_project = vdjpy.prompt_user('current project')
    current_uuid = vdjpy.get_uuid(args.current_project, my_agave)
    if current_uuid is None:
        sys.exit()

    # -d
    if args.destination_project is None:
        args.destination_project = vdjpy.prompt_user('destination project')
    destination_uuid = vdjpy.get_uuid(args.destination_project, my_agave)
    if destination_uuid is None:
        sys.exit()

    # SET UP FILETYPE AND GET FILE NAME IN ARGS.FILE_NAME
    # -f (default file type)
    if args.file_name is not '' or args.jobfile_name is '':
        if args.file_name is None:
コード例 #29
0
import vdjpy

if __name__ == '__main__':

    # arguments
    parser = argparse.ArgumentParser(description = 'Remove roles for a user on a system.')
    parser.add_argument('-s', '--systemID', dest = 'systemID', nargs = '?', help = 'system ID')
    parser.add_argument('-u', '--username', dest = 'username', nargs = '?', help = 'user to be removed')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # system
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system ID')
    kwargs['systemId'] = args.systemID

    # username
    if args.username is None:
        args.username = vdjpy.prompt_user('username to delete from system')
    kwargs['username'] = args.username

    # get systems
    my_agave = vdjpy.make_vdj_agave(args.accesstoken)
    role_delete = my_agave.systems.deleteRoleForUser(**kwargs)
    
    if role_delete is None:
        print 'Succesfully removed permissions for app', args.appID
    else:
        print 'Permission removal was not successfull. The message returned from the request was:\n' + json.dumps(role_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))
コード例 #30
0
ファイル: files-pems-update.py プロジェクト: jturcino/vdj-cli
    parser.add_argument('-a', '--access', dest = 'access', nargs = '?', help = 'permissions to grant to user')
    parser.add_argument('-r', '--recursive', dest = 'recursive', action = 'store_true', help = 'applies recursive permissions')
    parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
    parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
    args = parser.parse_args()

    kwargs = {}

    # -r
    recursive = 'false'
    if args.recursive:
        recursive = 'true'

    # -s
    if args.systemID is None:
        args.systemID = vdjpy.prompt_user('system')
    kwargs['systemId'] = args.systemID

    # -p
    if args.path is None:
        args.path = vdjpy.prompt_user('path')
    kwargs['filePath'] = args.path

    # -u
    if args.username is None:
        args.username = vdjpy.prompt_user('username to update')
    
    if args.access is None:
        print 'Valid permission options are as follows: \n\tREAD \n\tWRITE \n\tEXECUTE \n\tREAD_WRITE \n\tREAD_EXECUTE \n\tWRITE_EXECUTE \n\tALL \n\tNONE'
        args.access = vdjpy.prompt_user('permission to set')