How to run a python script as a future/promise (reticulate) in r shiny?

When I call a python script from a "future" I receive the following error:

Listening on http://127.0.0.1:5147 Unhandled promise error: Failed to retrieve the value of MultisessionFuture () from cluster RichSOCKnode #1 (PID 23834 on localhost ‘localhost’). The reason reported was ‘error reading from connection’. Post-mortem diagnostic: Failed to determine whether a process with this PID exists or not, i.e. cannot infer whether localhost worker is alive or not.

source_python('./python_ref.py')

server <- function(input, output, session) {
myFuture <- future({
        Sys.sleep(10)
        #lhdbpull = testMethod(value1, value2, value3, value4, zvtags)
        #system("python3 /home/zvidanov/tmp/pch/abcmp/python_ref.py value1, value2, value3, value4, zvtags" )
        testMethod(value1, value2, value3, value4, zvtags)
      })
      then(myFuture, onFulfilled = function(value) {
        shinyjs::enable("run")
        output$loading <- renderUI("Done")
        dataset = crunchdata(fbs, fbr, fas, far)
        p_plt(pp(dataset$datast,input$before[1],input$before[2],input$after[1],input$after[2]))
        p_tab(dataset$datatab)
      },
      onRejected = NULL)
}

Here is the python script for reference (calling another script)

cat python_ref.py
import ab_read_lhdb
def testMethod(time1, time2, time3, time4,lszv):
        ab_read_lhdb.main(time1,time2,"rcvd",lszv)
        #return ("before rcvd finished")
        ab_read_lhdb.main(time1,time2,"srvd",lszv)
        #return ("before srvd finished")
        ab_read_lhdb.main(time3,time4,"rcvd",lszv)
        #return ("after rcvd finished")
        ab_read_lhdb.main(time3,time4,"srvd",lszv)
        return ("LHDB Data pull finished")

Is there a way to make this work?
Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.