shareddata 3.6.2__tar.gz → 3.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {shareddata-3.6.2/src/shareddata.egg-info → shareddata-3.7.1}/PKG-INFO +1 -1
  2. {shareddata-3.6.2 → shareddata-3.7.1}/setup.cfg +1 -1
  3. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/Schedule.py +11 -4
  4. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/Worker.py +18 -31
  5. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/WorkerLib.py +39 -9
  6. {shareddata-3.6.2 → shareddata-3.7.1/src/shareddata.egg-info}/PKG-INFO +1 -1
  7. {shareddata-3.6.2 → shareddata-3.7.1}/LICENSE +0 -0
  8. {shareddata-3.6.2 → shareddata-3.7.1}/README.md +0 -0
  9. {shareddata-3.6.2 → shareddata-3.7.1}/pyproject.toml +0 -0
  10. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/AWSKinesis.py +0 -0
  11. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/AWSS3.py +0 -0
  12. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/DataFrame.py +0 -0
  13. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Defaults.py +0 -0
  14. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Logger.py +0 -0
  15. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Metadata.py +0 -0
  16. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/MultiProc.py +0 -0
  17. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/RealTime.py +0 -0
  18. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/ReadLogs.py +0 -0
  19. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/Scheduler.py +0 -0
  20. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/SendCommand.py +0 -0
  21. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/Server.py +0 -0
  22. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Routines/__init__.py +0 -0
  23. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/SharedData.py +0 -0
  24. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/SharedNumpy.py +0 -0
  25. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Table.py +0 -0
  26. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/TableIndex.py +0 -0
  27. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/TableIndexJit.py +0 -0
  28. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/TimeSeries.py +0 -0
  29. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/TimeseriesContainer.py +0 -0
  30. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/Utils.py +0 -0
  31. {shareddata-3.6.2 → shareddata-3.7.1}/src/SharedData/__init__.py +0 -0
  32. {shareddata-3.6.2 → shareddata-3.7.1}/src/shareddata.egg-info/SOURCES.txt +0 -0
  33. {shareddata-3.6.2 → shareddata-3.7.1}/src/shareddata.egg-info/dependency_links.txt +0 -0
  34. {shareddata-3.6.2 → shareddata-3.7.1}/src/shareddata.egg-info/requires.txt +0 -0
  35. {shareddata-3.6.2 → shareddata-3.7.1}/src/shareddata.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shareddata
3
- Version: 3.6.2
3
+ Version: 3.7.1
4
4
  Summary: Shared Memory Database with S3 repository
5
5
  Home-page: https://github.com/jcarlitooliveira/SharedData
6
6
  Author: Jose Carlito de Oliveira Filho
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = shareddata
3
- version = 3.6.2
3
+ version = 3.7.1
4
4
  author = Jose Carlito de Oliveira Filho
5
5
  author_email = jcarlitooliveira@gmail.com
6
6
  description = Shared Memory Database with S3 repository
@@ -285,11 +285,13 @@ class Schedule:
285
285
  sched = self.schedule
286
286
 
287
287
  # Run pending routines
288
- dfpending = sched[sched['status'] == 'PENDING']
289
-
288
+ idx = sched['status'] == 'PENDING'
289
+ idx = (idx) | (sched['status'] == 'START')
290
+ idx = (idx) | (sched['status'] == 'RESTART')
291
+ dfpending = sched[idx]
290
292
  for i in dfpending.index:
291
293
  r = dfpending.loc[i].copy()
292
- if str(r['lastmsg']) == 'nan':
294
+ if (str(r['lastmsg']) == 'nan') | (r['status']=='RESTART'):
293
295
  newcommand = True
294
296
  target = r['computer']
295
297
 
@@ -302,14 +304,19 @@ class Schedule:
302
304
  branch = ''
303
305
  repo = r['script'].split('/')[0]
304
306
  routine = r['script'].replace(repo, '')[1:]+'.py'
307
+
308
+ job = "routine"
309
+ if r['status']=='RESTART':
310
+ job = "restart"
305
311
 
306
312
  data = {
307
313
  "sender": "MASTER",
308
- "job": "routine",
314
+ "job": job,
309
315
  "target": target,
310
316
  "repo": repo,
311
317
  "routine": routine
312
318
  }
319
+
313
320
  if branch != '':
314
321
  data['branch'] = branch
315
322
 
@@ -138,37 +138,24 @@ while True:
138
138
  Logger.log.info(statusstr)
139
139
 
140
140
  elif command['job'] == 'kill':
141
- if command['repo'] == 'ALL':
142
- Logger.log.info('Kill: ALL...')
143
- for routine in routines:
144
- try:
145
- routine['process'].kill()
146
- except:
147
- pass
148
- Logger.log.info('Kill: ALL DONE!')
149
- else:
150
- for routine in routines:
151
- kill = False
152
- if (routine['command']['repo'] == command['repo']):
153
- if 'routine' in command:
154
- if (routine['command']['routine'] == command['routine']):
155
- kill = True
156
- else:
157
- kill = True
158
-
159
- if (kill) & ('process' in routine):
160
- try:
161
- routine['process'].kill()
162
- if 'routine' in command:
163
- Logger.log.info('Kill: %s/%s %.2fs DONE!' %
164
- (routine['command']['repo'], routine['command']['routine'],
165
- time.time()-routine['start_time']))
166
- else:
167
- Logger.log.info('Kill: %s %.2fs DONE!' %
168
- (routine['command']['repo'], time.time()-routine['start_time']))
169
- except:
170
- pass
171
-
141
+ kill_routine(command,routines)
142
+
143
+ elif command['job'] == 'restart':
144
+ kill_routine(command,routines)
145
+
146
+ start_time = time.time()
147
+ routine = {
148
+ 'command': command,
149
+ 'thread': None,
150
+ 'process': None,
151
+ 'start_time': start_time,
152
+ }
153
+ thread = Thread(target=run_routine,
154
+ args=(command, routine))
155
+ routine['thread'] = thread
156
+ routines.append(routine)
157
+ thread.start()
158
+
172
159
  elif command['job'] == 'restart worker':
173
160
  restart_program()
174
161
 
@@ -137,7 +137,7 @@ def list_proc():
137
137
  pinfo = proc.as_dict(attrs=None)
138
138
  if len(pinfo['cmdline']) > 0:
139
139
  if str(source_path) in pinfo['cmdline'][0]:
140
- procdict[proc.pid] = {'proc': proc, 'pinfo': pinfo}
140
+ procdict[proc.pid] = {'proc': proc, 'pinfo': pinfo}
141
141
  except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
142
142
  pass
143
143
  return procdict
@@ -200,13 +200,46 @@ def run_routine(command, routine):
200
200
 
201
201
  routine['process'] = subprocess.Popen(cmd, env=env)
202
202
 
203
-
204
203
  Logger.log.info('Starting process %s/%s DONE!' %
205
204
  (command['repo'], command['routine']))
206
205
  else:
207
206
  Logger.log.error(
208
207
  'Aborting routine %s, could not install repo' % (command['routine']))
209
208
 
209
+ def kill_routine(command, routines):
210
+ if command['repo'] == 'ALL':
211
+ Logger.log.info('Kill: ALL...')
212
+ for routine in routines:
213
+ try:
214
+ routine['process'].kill()
215
+ routines.remove(routine)
216
+ except:
217
+ pass
218
+ Logger.log.info('Kill: ALL DONE!')
219
+ else:
220
+ for routine in routines:
221
+ kill = False
222
+ if (routine['command']['repo'] == command['repo']):
223
+ if 'routine' in command:
224
+ if (routine['command']['routine'] == command['routine']):
225
+ kill = True
226
+ else:
227
+ kill = True
228
+
229
+ if (kill) & ('process' in routine):
230
+ try:
231
+ routine['process'].kill()
232
+ routines.remove(routine)
233
+ if 'routine' in command:
234
+ Logger.log.info('Kill: %s/%s %.2fs DONE!' %
235
+ (routine['command']['repo'], routine['command']['routine'],
236
+ time.time()-routine['start_time']))
237
+ else:
238
+ Logger.log.info('Kill: %s %.2fs DONE!' %
239
+ (routine['command']['repo'], time.time()-routine['start_time']))
240
+ except:
241
+ pass
242
+
210
243
 
211
244
  def install_repo(command, routine=None):
212
245
 
@@ -319,6 +352,7 @@ def install_repo(command, routine=None):
319
352
  Logger.log.error('Installing %s ERROR!' % (command['repo']))
320
353
  return runroutine
321
354
 
355
+
322
356
  def start_schedules(schedule_names):
323
357
  # run logger
324
358
  command = {
@@ -326,7 +360,7 @@ def start_schedules(schedule_names):
326
360
  "target": os.environ['USER_COMPUTER'],
327
361
  "job": "routine",
328
362
  "repo": "SharedData",
329
- "routine": "Routines.ReadLogs",
363
+ "routine": "Routines.ReadLogs",
330
364
  }
331
365
  start_time = time.time()
332
366
  routine = {
@@ -337,7 +371,7 @@ def start_schedules(schedule_names):
337
371
  }
338
372
  run_routine(command, routine)
339
373
 
340
- #run scheduler
374
+ # run scheduler
341
375
  command = {
342
376
  "sender": "MASTER",
343
377
  "target": os.environ['USER_COMPUTER'],
@@ -354,8 +388,4 @@ def start_schedules(schedule_names):
354
388
  'start_time': start_time,
355
389
  }
356
390
  run_routine(command, routine)
357
- # thread = Thread(target=run_routine,
358
- # args=(command, routine))
359
- # routine['thread'] = thread
360
- # routines.append(routine)
361
- # thread.start()
391
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shareddata
3
- Version: 3.6.2
3
+ Version: 3.7.1
4
4
  Summary: Shared Memory Database with S3 repository
5
5
  Home-page: https://github.com/jcarlitooliveira/SharedData
6
6
  Author: Jose Carlito de Oliveira Filho
File without changes
File without changes
File without changes