2019-07-21 23:55:38 +00:00
|
|
|
from multiprocessing import Process, Queue, freeze_support
|
|
|
|
import queue
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
import _ed_lrr
|
|
|
|
from collections import namedtuple
|
|
|
|
|
|
|
|
|
|
|
|
class Preprocessor(Process):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__()
|
|
|
|
self.state = {}
|
|
|
|
self.queue = Queue()
|
|
|
|
self.daemon = True
|
|
|
|
self.args = args
|
|
|
|
self.kwargs = kwargs
|
|
|
|
self.kwargs["callback"] = self.callback
|
|
|
|
|
|
|
|
def callback(self, state):
|
|
|
|
self.queue.put({"status": state})
|
|
|
|
|
|
|
|
def run(self):
|
2019-08-04 22:05:44 +00:00
|
|
|
res = _ed_lrr.preprocess(*self.args, **self.kwargs)
|
|
|
|
self.queue.put({"result": res})
|
2019-07-21 23:55:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
freeze_support()
|
|
|
|
r = Preprocessor(
|
|
|
|
r"D:\devel\rust\ED_LRR\dumps\systemsWithCoordinates.json",
|
|
|
|
r"D:\devel\rust\ED_LRR\dumps\bodies.json",
|
|
|
|
r"D:\devel\rust\ED_LRR\stars.csv",
|
|
|
|
)
|
|
|
|
for i, e in enumerate(r):
|
|
|
|
print(e)
|