![]() How do I not make it block the rest of the Python script and then kill it once the python methods have finished running and returned a value? Much thanks. I can't get the get_user_recommendations to run because the JVM server is blocking the process. Where: from py4j.java_gateway import JavaGateway ![]() J_id_list = ListConverter().convert(class_list, self.gateway._gateway_client) Print "recommendations" + str(r.get_users_recommendation(sys.argv))ĭef get_users_recommendation(self, user_list): import time import threading class TestThreading(object): def init(self, interval1): self.interval interval thread threading.Thread(n, args()) thread.daemon True thread.start() def run(self): while True: More statements comes here print(().str() + ' : Start task in the background') time.sleep(. Python code: process = subprocess.Popen('runJVM.sh', shell=True, stderr=subprocess.STDOUT)Īssert len(sys.argv) > 1, '%d arguments supplied, one needed' %(len(sys.argv)-1) I need the JVM to run while I'm calling another function, and I need to stop the JVM after the process has finished running. However, my problem is that the correct way I have it written, the JVM starts and blocks the rest of the processes that happen after it. I'm writing an application in python that initiates a JVM in java by calling a shell script using a python subprocess.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |