コード例 #1
0
def exec_before_job( app, inp_data, out_data, param_dict, tool=None):
    """Build a temp file with errors in it"""
    errors = []
    for name, data in inp_data.items():
        validation_errors = data.validation_errors
        for error in validation_errors:
            # build dummy class
            try:
                temp = eval(error.err_type)()
            except:
                temp = object()
            # stuff attributes
            temp.__dict__ = util.string_to_object( error.attributes )
            errors.append(temp)
    # There *should* only be 1 input, so we assume there is and continue
    # base64 pickel
    errors_str = util.object_to_string( errors )
    # write
    database_tmp = "./database/tmp" # globaly visible path
    error_file = tempfile.NamedTemporaryFile(mode="w", dir=database_tmp, suffix=".b64")
    error_file_name = error_file.name
    error_file.close()
    error_file = open(error_file_name, "w")
    error_file.write(errors_str)
    error_file.close()
    param_dict["errorsfile"] = error_file_name
コード例 #2
0
    def index(self, trans, init=False, **kwd):
        base_url = None
        params = dict(kwd)
        try:
            store = params.get("__GALAXY__", None)
            if store:
                store = json.loads(util.string_to_object(store))
            else:
                store = {}
            UCSC_URL = 'UCSC_URL'
            base_url = store.get(UCSC_URL,
                                 "http://genome.ucsc.edu/cgi-bin/hgTables?")
            params = dict(kwd)
            params['init'] = init

            if not init:
                for key, value in kwd.items():
                    store[key] = value
                try:
                    del store["__GALAXY__"]
                except:
                    pass
            else:
                store = {}

            if init == "1":
                base_url = "http://genome.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "2":
                base_url = "http://genome-test.cse.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "3":
                base_url = "http://archaea.ucsc.edu/cgi-bin/hgTables?"

            store[UCSC_URL] = base_url

            try:
                del params["__GALAXY__"]
            except:
                pass
            url = base_url + urllib.urlencode(params)

            page = urllib.urlopen(url)
            content = page.info().get('Content-type', '')
        except Exception, exc:
            trans.log_event("Proxy Error -> %s" % str(exc))
            msg = 'There has been a problem connecting to <i>%s</i> <p> <b>%s<b>' % (
                base_url, exc)
            return msg
コード例 #3
0
ファイル: ucsc_proxy.py プロジェクト: mb12985/Galaxy
    def index(self, trans, init=False, **kwd):
        base_url = None
        params = dict(kwd)
        try:
            store = params.get("__GALAXY__", None)
            if store:
                store = json.loads(util.string_to_object(store))
            else:
                store = {}
            UCSC_URL = 'UCSC_URL'
            base_url = store.get(UCSC_URL, "http://genome.ucsc.edu/cgi-bin/hgTables?")
            params = dict(kwd)
            params['init'] = init

            if not init:
                for key, value in kwd.items():
                    store[key] = value
                try:
                    del store["__GALAXY__"]
                except:
                    pass
            else:
                store = {}

            if init == "1":
                base_url = "http://genome.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "2":
                base_url = "http://genome-test.cse.ucsc.edu/cgi-bin/hgTables?"
                params['db'] = 'hg17'
            if init == "3":
                base_url = "http://archaea.ucsc.edu/cgi-bin/hgTables?"

            store[UCSC_URL] = base_url

            try:
                del params["__GALAXY__"]
            except:
                pass
            url = base_url + urllib.urlencode(params)

            page = urllib.urlopen(url)
            content = page.info().get('Content-type', '')
        except Exception, exc:
            trans.log_event( "Proxy Error -> %s" % str(exc) )
            msg = 'There has been a problem connecting to <i>%s</i> <p> <b>%s<b>' % (base_url, exc)
            return msg
コード例 #4
0
def main():
    options, args = doc_optparse.parse( __doc__ )

    try:
        extension = options.ext
    except:
        doc_optparse.exception()

    # create datatype
    data = model.Dataset( extension=extension, id=int( args[0] ) )
    data.file_path = "/home/ian/trunk/database/files/"
    
    if options.metadata:
        data.metadata = util.string_to_object( options.metadata )

    errors = data.datatype.validate( data )
    print util.object_to_string(errors)
コード例 #5
0
ファイル: fix_errors.py プロジェクト: iamciera/galaxy-dist
def main():
    options, args = doc_optparse.parse(__doc__)
    methods = []
    try:
        if options.methods: methods = options.methods.split(",")
    except:
        pass

    ext = options.ext

    in_file = open(args[0], "r")
    error_file = open(args[1], "r")
    out_file = open(args[2], "w")

    # string_to_object errors
    error_list = util.string_to_object(error_file.read())
    # index by error type and then by line number
    error_lines = {}
    error_types = {}
    for error in error_list:
        if error.linenum:
            if error.linenum in error_lines:
                error_lines[error.linenum].append(error)
            else:
                error_lines[error.linenum] = [error]
        error_type = error.__class__.__name__
        if error_type in error_types:
            error_types[error_type].append(error)
        else:
            error_types[error_type] = [error]

    linenum = 0
    for line in in_file:
        linenum += 1
        # write unless
        if "lines" in methods:
            if linenum in error_lines:
                line = None
            # other processing here?
        if line:
            out_file.write(line)
コード例 #6
0
def main():
    options, args = doc_optparse.parse( __doc__ )
    methods = []
    try:
        if options.methods: methods = options.methods.split(",")
    except:
        pass
    
    ext = options.ext

    in_file = open(args[0], "r")
    error_file = open(args[1], "r")
    out_file = open(args[2], "w")

    # string_to_object errors
    error_list = util.string_to_object(error_file.read())
    # index by error type and then by line number
    error_lines = {}
    error_types = {}
    for error in error_list:
        if error.linenum:
            if error.linenum in error_lines:
                error_lines[error.linenum].append(error)
            else:
                error_lines[error.linenum] = [error]
        error_type = error.__class__.__name__
        if error_type in error_types:
            error_types[error_type].append(error)
        else:
            error_types[error_type] = [error]

    linenum = 0
    for line in in_file:
        linenum += 1
        # write unless
        if "lines" in methods:
            if linenum in error_lines:
                line = None
            # other processing here?
        if line:
            out_file.write(line)
コード例 #7
0
 def __string_to_state(self, state_string):
     encoded_state = string_to_object(state_string)
     state = DefaultToolState()
     state.decode(encoded_state, self.tool, self.app)
     return state
コード例 #8
0
ファイル: test_execution.py プロジェクト: BinglanLi/galaxy
 def __string_to_state( self, state_string ):
     encoded_state = string_to_object( state_string )
     state = DefaultToolState()
     state.decode( encoded_state, self.tool, self.app )
     return state