Simplified code below...
*SERVER CODE:*
#!/usr/bin/env python
import os
import util
import job
import multiprocessing
import rpyc
class MyClass(rpyc.Service):
""" Manages jobs requested on a Node instance"""
def exposed_submitJobObj(self,newJob):
"""Create a new Job using the input arguments"""
self.addJobToQueue(newJob)
def addJobToQueue(self,newJob):
"""Adds a new job to the node job execution queue and executes it"""
#execute the job in a new thread
myJobWorker = multiprocessing.Process(target=self.jobWorker, args=(
newJob,))
myJobWorker.start()
def jobWorker(self,currJob):
"""Multiprocess method to run job as a parallel process """
currJob.execute()
def startNode():
from rpyc.utils.server import ThreadedServer
t = ThreadedServer(NodeManager, port = 18861, protocol_config = {
"allow_public_attrs" : True,"allow_pickle":True})
t.start()
if __name__ == '__main__':
startNode()
*CLIENT CODE:*
#!/usr/bin/env python
import os
import job
import util
import rpyc
def testJobWrapper():
c = rpyc.connect("localhost", 18861, config = {"allow_public_attrs" :
True,"allow_pickle":True})
winenv='C:\\mydir\\mysubdir\\test.env'
winarg=['param1']
wincmd = 'C:\\mydir\\mysubdir\\hellow.bat'
winJob = job.Job(wincmd,winarg)
testJob = job.JobWrapper()
testJob.setJobAttributes(winenv,winJob)
c.root.exposed_submitJobObj(testJob)
if __name__ == '__main__':
#testJob()
testJobWrapper()
--
---
You received this message because you are subscribed to the Google Groups
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.