Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# (c) Stefan Countryman 2016-2018 

2 

3""" 

4FileHandlers that initialize timing checks for an event as part of LLAMA 

5analysis. This is a kludge to do work that's not actually related to LLAMA. 

6""" 

7 

8import logging 

9import subprocess 

10from llama.filehandler import ( 

11 FileHandler, 

12 GenerationError, 

13) 

14from llama.filehandler.mixins import ( 

15 OnlineVetoMixin, 

16 ObservingVetoMixin, 

17) 

18from llama.files.skymap_info import SkymapInfo 

19 

20LOGGER = logging.getLogger(__name__) 

21 

22 

23# pylint: disable=too-many-ancestors 

24class TimingChecks(FileHandler, OnlineVetoMixin, ObservingVetoMixin): 

25 """ 

26 Initialize GECo timing checks on ldas-pcdev2.ligo.caltech.edu to help 

27 confirm validity of GW observation. 

28 """ 

29 

30 FILENAME = "timing_checks.log" 

31 DEPENDENCIES = (SkymapInfo,) 

32 

33 def _generate(self): # pylint: disable=arguments-differ 

34 gpstime = SkymapInfo(self).event_time_gps_seconds 

35 graceid = SkymapInfo(self).graceid 

36 cmd_fmt = ('nohup ~/dev/geco_data/timing_checks.py -t {} -g {} ' 

37 '>>~/timing_checks.log 2>&1 &') 

38 cmd = cmd_fmt.format(gpstime, graceid) 

39 remote_cmd = ['gsissh', '-n', '-f', 'ldas-pcdev2.ligo.caltech.edu', 

40 cmd] 

41 proc = subprocess.Popen(remote_cmd, stdout=subprocess.PIPE, 

42 stderr=subprocess.PIPE) 

43 res, err = proc.communicate() 

44 if proc.returncode != 0: 

45 raise GenerationError() 

46 with open(self.fullpath, 'w') as outf: 

47 outf.write(('Successfully started plotting process using command: ' 

48 '{}').format(remote_cmd)) 

49 outf.write('STDOUT:\n{}\n'.format(res)) 

50 outf.write('STDERR:\n{}\n'.format(err))