Commit e0e1f231 authored by vertighel's avatar vertighel
Browse files

dev

parent 556dc885
Loading
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -13,13 +13,11 @@ import sys
import os
import argparse # New import
from pathlib import Path # New import
import importlib.resources # New import

# Third-party modules
from datetime import datetime

# Custom modules
from .utils import check # Corrected relative import
from .utils.logger import log # Corrected relative import

class Sequencer():
@@ -175,7 +173,7 @@ class Sequencer():
        log.debug(f"Total elapsed time for OB {self.ob_file}: {(datetime.utcnow()-now).total_seconds() :.3f}s")

        
    def interrupt(self, signum, frame):
    def interrupt(self):
        '''Intercept a CTRL+C instead of raising a KeyboardInterrupt exception
        in order to be able to operate on the template class, for
        example to modify a pause attribute or call a method.
@@ -200,7 +198,6 @@ class Sequencer():
                self.quit()
            else:
                log.info("SEQUENCER: No valid action taken on interrupt.")
                pass
        
        except (KeyboardInterrupt, RuntimeError): # If Ctrl+C is hit again during input
            log.warning("SEQUENCER: Interrupted during interrupt handling. Quitting.")
@@ -258,6 +255,7 @@ class Sequencer():

    def quit(self):
        '''Abort the execution of the whole OB'''
        
        msg = f"SEQUENCER: Quit detected during OB {self.ob_file}."
        log.error(msg)
        self.error.append(msg)
@@ -273,6 +271,11 @@ class Sequencer():

            
def cli():
    '''
    Command line interface for sequencer
    '''

    
    parser = argparse.ArgumentParser(
        description="Noctua Observatory Sequencer: Loads and executes Observation Blocks (OBs) or individual template scripts.",
        formatter_class=argparse.RawTextHelpFormatter