当前位置: 首页>>代码示例>>Python>>正文


Python WebProcessingService.execute方法代码示例

本文整理汇总了Python中owslib.wps.WebProcessingService.execute方法的典型用法代码示例。如果您正苦于以下问题:Python WebProcessingService.execute方法的具体用法?Python WebProcessingService.execute怎么用?Python WebProcessingService.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在owslib.wps.WebProcessingService的用法示例。


在下文中一共展示了WebProcessingService.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _executeRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
 def _executeRequest(self, processid, inputs, verbose):
     """
     This function makes a call to the Web Processing Service with
     the specified user inputs.
     """
     
     wps = WebProcessingService(WPS_URL)
     
     # if verbose=True, then will we will monitor the status of the call.
     # if verbose=False, then we will return only the file outputpath.
     if not verbose:
         # redirects the standard output to avoid printing request status
         old_stdout = sys.stdout
         result = StringIO()
         sys.stdout = result
         
         # executes the request
         execution = wps.execute(processid, inputs, output = "OUTPUT")
         monitorExecution(execution, download=True)    
         
         # sets the standard output back to original
         sys.stdout = old_stdout
         result_string = result.getvalue()
         
         #parses the redirected output to get the filepath of the saved file
         output = result_string.split('\n')
         tmp = output[len(output) - 2].split(' ')
         return tmp[len(tmp)-1]
 
     # executes the request
     execution = wps.execute(processid, inputs, output = "OUTPUT")
     monitorExecution(execution, download=True)   
开发者ID:prog556,项目名称:pyGDP,代码行数:34,代码来源:pyGDP.py

示例2: test_wps_response6

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def test_wps_response6():
    # Build WPS object; service has been down for some time so skip caps here
    wps = WebProcessingService('http://rsg.pml.ac.uk/wps/vector.cgi', skip_caps=True)

    # Execute face WPS invocation
    request = open(resource_file('wps_PMLExecuteRequest6.xml'), 'rb').read()
    response = open(resource_file('wps_PMLExecuteResponse6.xml'), 'rb').read()
    execution = wps.execute(None, [], request=request, response=response)

    # Check execution result
    assert execution.status == 'ProcessSucceeded'
    assert execution.url == 'http://rsg.pml.ac.uk/wps/vector.cgi'
    assert execution.statusLocation == \
        'http://rsg.pml.ac.uk/wps/wpsoutputs/pywps-132084838963.xml'
    assert execution.serviceInstance == \
        'http://rsg.pml.ac.uk/wps/vector.cgi?service=WPS&request=GetCapabilities&version=1.0.0'
    assert execution.version == '1.0.0'
    # check single output
    output = execution.processOutputs[0]
    assert output.identifier == 'output'
    assert output.title == 'Name for output vector map'
    assert output.mimeType == 'text/xml'
    assert output.dataType == 'ComplexData'
    assert output.reference is None

    response = output.data[0]
    should_return = '''<ns3:FeatureCollection xmlns:ns3="http://ogr.maptools.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://www.opengis.net/wps/1.0.0" xsi:schemaLocation="http://ogr.maptools.org/ output_0n7ij9D.xsd">\n\t\t\t\t\t  <gml:boundedBy xmlns:gml="http://www.opengis.net/gml">\n\t\t\t\t\t    <gml:Box>\n\t\t\t\t\t      <gml:coord><gml:X>-960123.1421801626</gml:X><gml:Y>4665723.56559387</gml:Y></gml:coord>\n\t\t\t\t\t      <gml:coord><gml:X>-101288.6510608822</gml:X><gml:Y>5108200.011823481</gml:Y></gml:coord>\n\t\t\t\t\t    </gml:Box>\n\t\t\t\t\t  </gml:boundedBy>                         \n\t\t\t\t\t  <gml:featureMember xmlns:gml="http://www.opengis.net/gml">\n\t\t\t\t\t    <ns3:output fid="F0">\n\t\t\t\t\t      <ns3:geometryProperty><gml:LineString><gml:coordinates>-960123.142180162365548,4665723.565593870356679,0 -960123.142180162365548,4665723.565593870356679,0 -960123.142180162598379,4665723.565593870356679,0 -960123.142180162598379,4665723.565593870356679,0 -711230.141176006174646,4710278.48552671354264,0 -711230.141176006174646,4710278.48552671354264,0 -623656.677859728806652,4848552.374973464757204,0 -623656.677859728806652,4848552.374973464757204,0 -410100.337491964863148,4923834.82589447684586,0 -410100.337491964863148,4923834.82589447684586,0 -101288.651060882242746,5108200.011823480948806,0 -101288.651060882242746,5108200.011823480948806,0 -101288.651060882257298,5108200.011823480948806,0 -101288.651060882257298,5108200.011823480948806,0</gml:coordinates></gml:LineString></ns3:geometryProperty>\n\t\t\t\t\t      <ns3:cat>1</ns3:cat>\n\t\t\t\t\t      <ns3:id>1</ns3:id>\n\t\t\t\t\t      <ns3:fcat>0</ns3:fcat>\n\t\t\t\t\t      <ns3:tcat>0</ns3:tcat>\n\t\t\t\t\t      <ns3:sp>0</ns3:sp>\n\t\t\t\t\t      <ns3:cost>1002619.181</ns3:cost>\n\t\t\t\t\t      <ns3:fdist>0</ns3:fdist>\n\t\t\t\t\t      <ns3:tdist>0</ns3:tdist>\n\t\t\t\t\t    </ns3:output>\n\t\t\t\t\t  </gml:featureMember>\n\t\t\t\t\t</ns3:FeatureCollection>'''  # noqa
    assert compare_xml(should_return, response) is True
开发者ID:PublicaMundi,项目名称:OWSLib,代码行数:30,代码来源:test_wps_response6.py

示例3: complex_input_with_content

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def complex_input_with_content():
    """
    use ComplexDataInput with a direct content
    """
    
    print("\ncomplex_input_with_content ...")
     
    wps = WebProcessingService('http://localhost:8094/wps', verbose=verbose)

    processid = 'wordcount'
    textdoc = ComplexDataInput("ALICE was beginning to get very tired ...")   # alice in wonderland
    inputs = [("text", textdoc)]
    # list of tuple (output identifier, asReference attribute, mimeType attribute)
    # when asReference or mimeType is None - the wps service will use its default option
    outputs = [("output",True,'some/mime-type')]

    execution = wps.execute(processid, inputs, output=outputs)
    monitorExecution(execution)

    # show status
    print('percent complete', execution.percentCompleted)
    print('status message', execution.statusMessage)

    for output in execution.processOutputs:
        print('identifier=%s, dataType=%s, data=%s, reference=%s' % (output.identifier, output.dataType, output.data, output.reference)) 
开发者ID:PublicaMundi,项目名称:OWSLib,代码行数:27,代码来源:wps-birdhouse.py

示例4: multiple_outputs

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def multiple_outputs():
    print("\nmultiple outputs ...")
    
    # get multiple outputs
    wps = WebProcessingService('http://localhost:8094/wps', verbose=verbose)

    processid = 'dummyprocess'
    inputs = [("input1", '1'), ("input2", '2')]
    # list of tuple (output identifier, asReference attribute)
    outputs = [("output1",True), ("output2",False)]

    execution = wps.execute(processid, inputs, output=outputs)
    monitorExecution(execution)

    # show status
    print('percent complete', execution.percentCompleted)
    print('status message', execution.statusMessage)

    # outputs
    for output in execution.processOutputs:
        print('identifier=%s, dataType=%s, data=%s, reference=%s' % (output.identifier, output.dataType, output.data, output.reference)) 

    # errors
    print(execution.status)
    for error in execution.errors:
            print(error.code, error.locator, error.text)
开发者ID:CatherineH,项目名称:OWSLib,代码行数:28,代码来源:wps-birdhouse.py

示例5: _generateRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
 def _generateRequest(self, dataSetURI, algorithm, method, varID=None, verbose=False):
     """
     Takes a dataset uri, algorithm, method, and datatype. This function will generate a simple XML document
     to make the request specified. (Only works for ListOpendapGrids and GetGridTimeRange). 
     
     Will return a list containing the info requested for (either data types or time range).
     """
     
     wps_Service = 'http://cida.usgs.gov/gdp/utility/WebProcessingService'
     POST = WebProcessingService(wps_Service, verbose=False)
     
     xmlGen = gdpXMLGenerator()
     root = xmlGen.getXMLRequestTree(dataSetURI, algorithm, method, varID, verbose)           
     
     # change standard output to not display waiting status
     if not verbose:
         old_stdout = sys.stdout
         result = StringIO()
         sys.stdout = result   
     request = etree.tostring(root)
     
     execution = POST.execute(None, [], request=request)
     if method == 'getDataSetTime':
         seekterm = 'time'
     else:
         seekterm = 'name'
     if not verbose:
         sys.stdout = old_stdout
     return self._parseXMLNodesForTagText(execution.response, seekterm)
开发者ID:prog556,项目名称:pyGDP,代码行数:31,代码来源:pyGDP.py

示例6: uploadShapeFile

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def uploadShapeFile(filePath):
    """
    Given a file, this function encodes the file and uploads it onto geoserver.
    """

    # encodes the file, opens it, reads it, and closes it
    # returns a filename in form of: filename_copy.zip
    filePath = _encodeZipFolder(filePath)
    if filePath is None:
        return

    filehandle = open(filePath, 'r')
    filedata = filehandle.read()
    filehandle.close()
    os.remove(filePath)  # deletes the encoded file

    # this if for naming the file on geoServer
    filename = filePath.split("/")
    # gets rid of filepath, keeps only filename eg: file.zip
    filename = filename[len(filename) - 1]
    filename = filename.replace("_copy.zip", "")

    xml_gen = gdpXMLGenerator()
    root = xml_gen.getUploadXMLtree(filename, upload_URL, filedata)

    # now we have a complete XML upload request
    upload_request = etree.tostring(root)
    post = WebProcessingService(WPS_Service)
    execution = post.execute(None, [], request=upload_request)
    monitorExecution(execution)
    return "upload:" + filename
开发者ID:USGS-CIDA,项目名称:pyGDP,代码行数:33,代码来源:upload_shapefile.py

示例7: run_wps

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def run_wps(process_id,input,output):
    #choose the first wps engine
    my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService', verbose=False, skip_caps=True)
    my_engine.getcapabilities()
    my_process = my_engine.describeprocess(process_id)
    my_inputs = my_process.dataInputs
    input_names = [] #getting list of input
    for input1 in my_inputs:
        input_names.append(input1)
    #executing the process..
    execution = my_engine.execute(process_id, input, output)
    request = execution.request
    #set store executeresponse to false
    request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')
    url_wps = 'http://appsdev.hydroshare.org:8282/wps/WebProcessingService'
    wps_request = urllib2.Request(url_wps,request)
    wps_open = urllib2.urlopen(wps_request)
    wps_read = wps_open.read()
    if 'href' in wps_read:
        tag = 'href="'
        location = wps_read.find(tag)
        new= wps_read[location+len(tag):len(wps_read)]
        tag2 = '"/>\n    </wps:Output>\n  </wps:ProcessOutputs>\n</wps:'
        location2 = new.find(tag2)
        final = new[0:location2]
        split = final.split()
        wps_request1 = urllib2.Request(split[0])
        wps_open1 = urllib2.urlopen(wps_request1)
        wps_read1 = wps_open1.read()

    #return [final_output_url, final_data]
    return [wps_read1, split]
开发者ID:shawncrawley,项目名称:timeseries_viewer,代码行数:34,代码来源:controllers.py

示例8: _executeRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
    def _executeRequest(self, processid, inputs, output, verbose):
        """
        This function makes a call to the Web Processing Service with
        the specified user inputs.
        """
        wps = WebProcessingService(WPS_URL)

        old_stdout = sys.stdout
        # create StringIO() for listening to print
        result = StringIO()
        if not verbose: # redirect standard output
            sys.stdout = result
        
        execution = wps.execute(processid, inputs, output)
        monitorExecution(execution, download=False) # monitors for success
    
        # redirect standard output after successful execution
        sys.stdout = result
        monitorExecution(execution, download=True)
                
        result_string = result.getvalue()
        output = result_string.split('\n')
        tmp = output[len(output) - 2].split(' ')  
        sys.stdout = old_stdout
        return tmp[len(tmp)-1]
开发者ID:schwehr,项目名称:pyGDP,代码行数:27,代码来源:pyGDP.py

示例9: _generateRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def _generateRequest(dataSetURI, algorithm, method, varID, verbose):
    """
    Takes a dataset uri, algorithm, method, and datatype. This function will generate a simple XML document
    to make the request specified. (Only works for ListOpendapGrids and GetGridTimeRange). 
    
    Will return a list containing the info requested for (either data types or time range).
    """
    
    POST = WebProcessingService(WPS_Service, verbose=verbose)
    
    xmlGen = gdpXMLGenerator()
    root = xmlGen.getXMLRequestTree(dataSetURI, algorithm, method, varID, verbose)           
     
    request = etree.tostring(root)
    
    execution = POST.execute(None, [], request=request)
    
    _execute_request._check_for_execution_errors(execution)
    
    if method == 'getDataSetTime':
        seekterm = '{xsd/gdptime-1.0.xsd}time'
    elif method == 'getDataType':
        seekterm = '{xsd/gdpdatatypecollection-1.0.xsd}name'
    elif method == 'getDataLongName':
        seekterm = '{xsd/gdpdatatypecollection-1.0.xsd}description'
    elif method == 'getDataUnits':
        seekterm = '{xsd/gdpdatatypecollection-1.0.xsd}unitsstring'
    
    return _parseXMLNodesForTagText(execution.response, seekterm)
开发者ID:ColinTalbert,项目名称:pyGDP,代码行数:31,代码来源:_webdata_xml_generate.py

示例10: _executeRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def _executeRequest(processid,
                    inputs,
                    output,
                    verbose=True,
                    outputFilePath=None,
                    sleepSecs=10):
    """
    This function makes a call to the Web Processing Service with
    the specified user inputs.
    """
    wps = WebProcessingService(WPS_URL)

    execution = wps.execute(processid, inputs, output)

    sleepSecs = sleepSecs
    err_count = 1

    while execution.isComplete() == False:
        try:
            monitorExecution(
                execution, sleepSecs, download=False)  # monitors for success
            err_count = 1
        except Exception:
            log.warning(
                'An error occurred while checking status, checking again. Sleeping %d seconds...'
                % sleepSecs)
            err_count += 1
            if err_count > WPS_attempts:
                raise Exception(
                    'The status document failed to return, status checking has aborted. There has been a network or server issue preventing the status document from being retrieved, the request may still be running. For more information, check the status url %s'
                    % execution.statusLocation)
            sleep(sleepSecs)

    if outputFilePath == None:
        outputFilePath = 'gdp_' + processid.replace(
            '.', '-') + '_' + strftime("%Y-%m-%dT%H-%M-%S-%Z")

    done = False
    err_count = 1
    while done == False:
        try:
            monitorExecution(execution, download=True, filepath=outputFilePath)
            done = True
        except Exception:
            log.warning(
                'An error occurred while trying to download the result file, trying again.'
            )
            err_count += 1
            sleep(sleepSecs)
            if err_count > WPS_attempts:
                raise Exception(
                    "The process completed successfully, but an error occurred while downloading the result. You may be able to download the file using the link at the bottom of the status document: %s"
                    % execution.statusLocation)

    _check_for_execution_errors(execution)

    return outputFilePath
开发者ID:mbucknell,项目名称:pyGDP,代码行数:59,代码来源:_execute_request.py

示例11: execute_workflow

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def execute_workflow(self, userid, url, workflow):
    registry = app.conf['PYRAMID_REGISTRY']
    db = mongodb(registry)

    # generate and run dispel workflow
    # TODO: fix owslib wps for unicode/yaml parameters
    logger.debug('workflow=%s', workflow)
    # using secure url
    workflow['worker']['url'] = secure_url(db, workflow['worker']['url'], userid)
    inputs=[('workflow', json.dumps(workflow))]
    logger.debug('inputs=%s', inputs)
    outputs=[('output', True), ('logfile', True)]
    
    wps = WebProcessingService(url=secure_url(db, url, userid), skip_caps=True, verify=False)
    worker_wps = WebProcessingService(url=workflow['worker']['url'], skip_caps=False, verify=False)
    execution = wps.execute(identifier='workflow', inputs=inputs, output=outputs)
    
    job = add_job(db, userid,
                  task_id = self.request.id,
                  is_workflow = True,
                  service = worker_wps.identification.title,
                  title = workflow['worker']['identifier'],
                  abstract = '',
                  status_location = execution.statusLocation)

    while execution.isNotComplete():
        try:
            execution.checkStatus(sleepSecs=3)
            job['status'] = execution.getStatus()
            job['status_message'] = execution.statusMessage
            job['is_complete'] = execution.isComplete()
            job['is_succeded'] = execution.isSucceded()
            job['progress'] = execution.percentCompleted
            duration = datetime.now() - job.get('created', datetime.now())
            job['duration'] = str(duration).split('.')[0]
            if execution.isComplete():
                job['finished'] = datetime.now()
                if execution.isSucceded():
                    for output in execution.processOutputs:
                        if 'output' == output.identifier:
                            result = yaml.load(urllib.urlopen(output.reference))
                            job['worker_status_location'] = result['worker']['status_location']
                    job['progress'] = 100
                    log(job)
                else:
                    job['status_message'] = '\n'.join(error.text for error in execution.errors)
                    for error in execution.errors:
                        log_error(job, error)
            else:
                log(job)
        except:
            logger.exception("Could not read status xml document.")
        else:
            db.jobs.update({'identifier': job['identifier']}, job)
    return execution.getStatus()
开发者ID:rmoorman,项目名称:pyramid-phoenix,代码行数:57,代码来源:tasks.py

示例12: run_wps

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def run_wps(process_id,input,output):

    #choose the first wps engine
    #my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService', verbose=False, skip_caps=True)
    my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService',verbose=False, skip_caps=True)
    my_engine.getcapabilities()
    #wps_engines = list_wps_service_engines()
    #my_engine = wps_engines[0]
    #choose the r.time-series-converter
    my_process = my_engine.describeprocess(process_id)

    my_inputs = my_process.dataInputs
    input_names = [] #getting list of input
    for input1 in my_inputs:
        input_names.append(input1)
    #executing the process..
    execution = my_engine.execute(process_id, input, output)
    request = execution.request
    #set store executeresponse to false
    request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')

    url_wps = 'http://appsdev.hydroshare.org:8282/wps/WebProcessingService'

    wps_request = urllib2.Request(url_wps,request)
    wps_open = urllib2.urlopen(wps_request)
    wps_read = wps_open.read()



    if 'href' in wps_read:
        tag = 'href="'
        location = wps_read.find(tag)

        new= wps_read[location+len(tag):len(wps_read)]
        tag2 = '"/>\n    </wps:Output>\n  </wps:ProcessOutputs>\n</wps:'
        location2 = new.find(tag2)
        final = new[0:location2]
        split = final.split()
        wps_request1 = urllib2.Request(split[0])

        wps_open1 = urllib2.urlopen(wps_request1)
        wps_read1 = wps_open1.read()

    #now we must use our own method to send the request1
    #we need to use the request
    #this code is for the normal wps which is not working right now
    # monitorExecution(execution)
    # output_data = execution.processOutputs
    # final_output_url = output_data[0].reference
    # final_data = read_final_data(final_output_url)

    #return [final_output_url, final_data]
    return [wps_read1, split]
开发者ID:mmbayles,项目名称:TimeSeries-Converter,代码行数:55,代码来源:controllers.py

示例13: _executeRequest

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
    def _executeRequest(self, processid, inputs, output, verbose):
        """
        This function makes a call to the Web Processing Service with
        the specified user inputs.
        """
        wps = WebProcessingService(WPS_URL)

        old_stdout = sys.stdout
        # create StringIO() for listening to print
        result = StringIO()
        if not verbose: # redirect standard output
            sys.stdout = result
        
        execution = wps.execute(processid, inputs, output)
        
        sleepSecs=10
        err_count=1
        
        while execution.isComplete()==False:
            try:
                monitorExecution(execution, sleepSecs, download=False) # monitors for success
                err_count=1
            except Exception:
                print 'An error occurred while checking status, checking again.'
                print 'Sleeping %d seconds...' % sleepSecs
                err_count+=1
                if err_count > WPS_attempts:
                    raise Exception('The status document failed to return, status checking has aborted. There has been a network or server issue preventing the status document from being retrieved, the request may still be running. For more information, check the status url %s' % execution.statusLocation)
                sleep(sleepSecs)
    
        # redirect standard output after successful execution
        sys.stdout = result
        done=False
        err_count=1
        while done==False:
            try: 
                monitorExecution(execution, download=True)
                done=True
            except Exception:
                print 'An error occurred while trying to download the result file, trying again.'
                err_count+=1
            if err_count > WPS_attempts:        
                raise Exception("The process completed successfully, but an error occurred while downloading the result. You may be able to download the file using the link at the bottom of the status document: %s" % execution.statusLocation)
            sleep(sleepSecs)
            
        result_string = result.getvalue()
        output = result_string.split('\n')
        tmp = output[len(output) - 2].split(' ')  
        sys.stdout = old_stdout
        return tmp[len(tmp)-1]
开发者ID:cameronbracken,项目名称:pyGDP,代码行数:52,代码来源:pyGDP.py

示例14: run_wps

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def run_wps(res_ids,gap):

    if (gap ==''):
        gap = "linear"

    # checks if there is two resource IDs
    resources = res_ids.split("_")

    process_id = 'org.n52.wps.server.r.series_gap_filler_3'
    process_input = [('resource_id',str(resources[0])),('fill_function',str(gap))]

    #setting the WPS URL is set in app.py
    url_wps = GapFillerTool.wps_url + '/WebProcessingService'
    my_engine = WebProcessingService(url_wps, verbose=False, skip_caps=True)
    my_process = my_engine.describeprocess(process_id)

    #executing the process..
    # build execution

    execution = WPSExecution(version=my_engine.version, url=my_engine.url, username=my_engine.username,
                             password=my_engine.password, verbose=my_engine.verbose)

    requestElement = execution.buildRequest(process_id, process_input, 'output')

    request = etree.tostring(requestElement)
    #set store executeresponse to false

    request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')

    execution = my_engine.execute(process_id, process_input, 'output', request)

    monitorExecution(execution)

    status = execution.status


    # if the status is successful...
    if status == 'ProcessSucceeded':
        outputs = execution.processOutputs
        output0 = outputs[0]
        reference0 = output0.reference

        # retrieve the data from the reference
        output_data = requests.get(reference0)
        resp = HttpResponse(output_data, content_type="application/json")

        return resp

    else:
        return JsonResponse({'status': 'wps request failed'})
开发者ID:mmbayles,项目名称:gap_filler,代码行数:52,代码来源:wps_utilities.py

示例15: test_wps_execute_invalid_request

# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import execute [as 别名]
def test_wps_execute_invalid_request():
    # Initialize WPS client
    wps = WebProcessingService('http://cida.usgs.gov/gdp/process/WebProcessingService')

    # Submit fake invocation of Execute operation using cached HTTP request and response
    request = open(resource_file('wps_USGSExecuteInvalidRequest.xml'), 'rb').read()
    response = open(resource_file('wps_USGSExecuteInvalidRequestResponse.xml'), 'rb').read()
    execution = wps.execute(None, [], request=request, response=response)

    assert execution.isComplete() is True

    # Display errors
    ex = execution.errors[0]
    assert ex.code is None
    assert ex.locator is None
    assert ex.text == 'Attribute null not found in feature collection'
开发者ID:earthserver-eu,项目名称:OWSLib,代码行数:18,代码来源:test_wps_execute_invalid_request.py


注:本文中的owslib.wps.WebProcessingService.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。