Share via

python function app throw exception after deployed

zehou zhang 1 Reputation point
2022-01-11T18:46:30.92+00:00

ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))".

My function throw exception after deployed, any one knows why?

tokenRequestModel = {
        "Domain": domain,
        "UserName":username,
        "Passward":password,
        "Op":"GetToken"
    }
    unsuccessful = {}
    # load channels map from csv file based on json configuration
    channelMaps = yield context.call_activity('LoadSeChannelsCsvActivity', filename)

    # get token
    token = yield context.call_activity('SeServerOpActivity', tokenRequestModel)

    stepList = list(divide_chunks(data, quota))
    size = len(stepList) 
    # update chunk processing
    for chunk in range(size):
        start = context.current_utc_datetime.timestamp()
        eachstep = stepList[chunk]
        for each in eachstep:
            key = each["n"]
            url = channelMaps[key]
            updateValueRequestModel = {
                "Token": token,
                "Url":url,
                "Value":each["v"],
                "Op":"UpdateValue"
            }
            key = each["n"]
            url = channelMaps[key]
            headers = { "Authorization": f"Bearer {token}", "Content-Type":"application/json" }
            try:
                updateValue = yield context.call_activity('SeServerOpActivity', updateValueRequestModel)
            except Exception as V:
                unsuccessful[key] = {
                     "value": each["v"],
                     "message": V
                }
            eachTimeout = context.current_utc_datetime + timedelta(seconds=1)
            yield context.create_timer(eachTimeout)
        # click for next minute after refresh of quota
        if chunk != size - 1:
            end = context.current_utc_datetime.timestamp()
            processingtime = (end - start)
            deduct = 60 - processingtime
            if deduct > 0:
                deadline = context.current_utc_datetime + timedelta(seconds=deduct)
                yield context.create_timer(deadline)    
    return {"data":unsuccessful}
Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.