def main():
    # We want to be able to call on these variables anywhere in the script.
    global single_thread
    global debug

    time_start = time()
    single_thread = False

    try:
        dx_session_obj = GetSession()
        logging_est(arguments['--logdir'])
        print_debug(arguments)
        config_file_path = arguments['--config']
        # Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)

        # This is the function that will handle processing main_workflow for
        # all the servers.
        run_job(dx_session_obj, config_file_path)

        elapsed_minutes = time_elapsed(time_start)
        print_info('script took {:.2f} minutes to get this far.'.format(
            elapsed_minutes))

    # Here we handle what we do when the unexpected happens
    except SystemExit as e:
        # This is what we use to handle our sys.exit(#)
        sys.exit(e)

    except DlpxException as e:
        # We use this exception handler when an error occurs in a function call.
        print_exception('ERROR: Please check the ERROR message below:\n'
                        '{}'.format(e.message))
        sys.exit(2)

    except HttpError as e:
        # We use this exception handler when our connection to Delphix fails
        print_exception('ERROR: Connection failed to the Delphix Engine. Please'
                        'check the ERROR message below:\n{}'.format(e.message))
        sys.exit(2)

    except JobError as e:
        # We use this exception handler when a job fails in Delphix so that we
        # have actionable data
        print_exception('A job failed in the Delphix Engine:\n{}'.format(e.job))
        elapsed_minutes = time_elapsed(time_start)
        print_exception('{} took {:.2f} minutes to get this far'.format(
            basename(__file__), elapsed_minutes))
        sys.exit(3)

    except KeyboardInterrupt:
        # We use this exception handler to gracefully handle ctrl+c exits
        print_debug('You sent a CTRL+C to interrupt the process')
        elapsed_minutes = time_elapsed(time_start)
        print_info('{} took {:.2f} minutes to get this far'.format(
            basename(__file__), elapsed_minutes))
    except:
        # Everything else gets caught here
        print_exception('{}\n{}'.format(sys.exc_info()[0],
                                        traceback.format_exc()))
        elapsed_minutes = time_elapsed(time_start)
        print_info("{} took {:.2f} minutes to get this far".format(
            basename(__file__), elapsed_minutes))
        sys.exit(1)
示例#2
0
def main(arguments):
    #We want to be able to call on these variables anywhere in the script.
    global single_thread
    global usebackup
    global time_start
    global config_file_path
    global dx_session_obj
    global debug

    if arguments['--debug']:
        debug = True

    try:
        dx_session_obj = GetSession()
        logging_est(arguments['--logdir'])
        print_debug(arguments)
        time_start = time()
        engine = None
        single_thread = False
        config_file_path = arguments['--config']
        #Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)

        #This is the function that will handle processing main_workflow for
        # all the servers.
        run_job()

        #elapsed_minutes = time_elapsed()
        print_info('script took {:.2f} minutes to get this far.'.format(
            time_elapsed()))

    #Here we handle what we do when the unexpected happens
    except SystemExit as e:
        """
        This is what we use to handle our sys.exit(#)
        """
        sys.exit(e)

    except HttpError as e:
        """
        We use this exception handler when our connection to Delphix fails
        """
        print_exception('Connection failed to the Delphix Engine'
                        'Please check the ERROR message:\n{}\n').format(e)
        sys.exit(1)

    except JobError as e:
        """
        We use this exception handler when a job fails in Delphix so that
        we have actionable data
        """
        elapsed_minutes = time_elapsed()
        print_exception('A job failed in the Delphix Engine')
        print_info('{} took {:.2f} minutes to get this far:\n{}\n'.format(
            basename(__file__), elapsed_minutes, e))
        sys.exit(3)

    except KeyboardInterrupt:
        """
        We use this exception handler to gracefully handle ctrl+c exits
        """
        print_debug("You sent a CTRL+C to interrupt the process")
        elapsed_minutes = time_elapsed()
        print_info('{} took {:.2f} minutes to get this far\n'.format(
            basename(__file__), elapsed_minutes))

    except:
        """
        Everything else gets caught here
        """
        print_exception(sys.exc_info()[0])
        elapsed_minutes = time_elapsed()
        print_info('{} took {:.2f} minutes to get this far\n'.format(
            basename(__file__), elapsed_minutes))
        sys.exit(1)
def main():
    # We want to be able to call on these variables anywhere in the script.
    global single_thread
    global debug

    time_start = time()
    single_thread = False

    try:
        dx_session_obj = GetSession()
        logging_est(arguments['--logdir'])
        print_debug(arguments)
        config_file_path = arguments['--config']
        # Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)

        # This is the function that will handle processing main_workflow for
        # all the servers.
        run_job(dx_session_obj, config_file_path)

        elapsed_minutes = time_elapsed(time_start)
        print_info('script took {:.2f} minutes to get this far.'.format(
            elapsed_minutes))

    # Here we handle what we do when the unexpected happens
    except SystemExit as e:
        # This is what we use to handle our sys.exit(#)
        sys.exit(e)

    except DlpxException as e:
        # We use this exception handler when an error occurs in a function call.
        print_exception('ERROR: Please check the ERROR message below:\n'
                        '{}'.format(e.message))
        sys.exit(2)

    except HttpError as e:
        # We use this exception handler when our connection to Delphix fails
        print_exception('ERROR: Connection failed to the Delphix Engine. Please'
                        'check the ERROR message below:\n{}'.format(e.message))
        sys.exit(2)

    except JobError as e:
        # We use this exception handler when a job fails in Delphix so that we
        # have actionable data
        print_exception('A job failed in the Delphix Engine:\n{}'.format(e.job))
        elapsed_minutes = time_elapsed(time_start)
        print_exception('{} took {:.2f} minutes to get this far'.format(
            basename(__file__), elapsed_minutes))
        sys.exit(3)

    except KeyboardInterrupt:
        # We use this exception handler to gracefully handle ctrl+c exits
        print_debug('You sent a CTRL+C to interrupt the process')
        elapsed_minutes = time_elapsed(time_start)
        print_info('{} took {:.2f} minutes to get this far'.format(
            basename(__file__), elapsed_minutes))
    except:
        # Everything else gets caught here
        print_exception('{}\n{}'.format(sys.exc_info()[0],
                                        traceback.format_exc()))
        elapsed_minutes = time_elapsed(time_start)
        print_info("{} took {:.2f} minutes to get this far".format(
            basename(__file__), elapsed_minutes))
        sys.exit(1)
def main(arguments):
    #We want to be able to call on these variables anywhere in the script.
    global single_thread
    global usebackup
    global time_start
    global config_file_path
    global dx_session_obj
    global debug

    if arguments['--debug']:
        debug = True

    try:
        dx_session_obj = GetSession()
        logging_est(arguments['--logdir'])
        print_debug(arguments)
        time_start = time()
        single_thread = False
        config_file_path = arguments['--config']
        #Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)

        #This is the function that will handle processing main_workflow for
        # all the servers.
        run_job()

        elapsed_minutes = time_elapsed()
        print_info('script took {:.2f} minutes to get this far.'.format(
            elapsed_minutes))

    #Here we handle what we do when the unexpected happens
    except SystemExit as e:
        """
        This is what we use to handle our sys.exit(#)
        """
        sys.exit(e)

    except HttpError as e:
        """
        We use this exception handler when our connection to Delphix fails
        """
        print_exception('Connection failed to the Delphix Engine'
                        'Please check the ERROR message:\n{}'.format(e))
        sys.exit(1)

    except JobError as e:
        """
        We use this exception handler when a job fails in Delphix so that
        we have actionable data
        """
        elapsed_minutes = time_elapsed()
        print_exception('A job failed in the Delphix Engine')
        print_info('{} took {:.2f} minutes to get this far\n{}'.format(
                   basename(__file__), elapsed_minutes, e))
        sys.exit(3)

    except KeyboardInterrupt:
        """
        We use this exception handler to gracefully handle ctrl+c exits
        """
        print_debug("You sent a CTRL+C to interrupt the process")
        elapsed_minutes = time_elapsed()
        print_info('{} took {:.2f} minutes to get this far\n'.format(
                   basename(__file__), elapsed_minutes))

    except:
        """
        Everything else gets caught here
        """
        print_exception(sys.exc_info()[0])
        elapsed_minutes = time_elapsed()
        print_info('{} took {:.2f} minutes to get this far\n'.format(
                   basename(__file__), elapsed_minutes))
        sys.exit(1)
示例#5
0
def main(argv):
    # We want to be able to call on these variables anywhere in the script.
    global single_thread
    global usebackup
    global time_start
    global config_file_path
    global database_name
    global host_name
    global dx_session_obj
    global debug

    try:
        dx_session_obj = GetSession()
        debug = arguments["--debug"]
        logging_est(arguments["--logdir"], debug)
        print_debug(arguments, debug)
        time_start = time()
        single_thread = False
        config_file_path = arguments["--config"]

        print_info("Welcome to %s version %s" % (basename(__file__), VERSION))

        # Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)

        database_name = arguments["--target"]
        host_name = arguments["--environment"]

        # This is the function that will handle processing main_workflow for
        # all the servers.
        run_job()

        elapsed_minutes = time_elapsed()
        print_info("script took %s minutes to get this far. " % (str(elapsed_minutes)))

    # Here we handle what we do when the unexpected happens
    except SystemExit as e:
        """
        This is what we use to handle our sys.exit(#)
        """
        sys.exit(e)

    except DlpxException as e:
        """
        We use this exception handler when an error occurs in a function call.
        """

        print ("\nERROR: Please check the ERROR message below:\n%s" % (e.message))
        sys.exit(2)

    except HttpError as e:
        """
        We use this exception handler when our connection to Delphix fails
        """
        print (
            "\nERROR: Connection failed to the Delphix Engine. Please "
            "check the ERROR message below:\n%s" % (e.message)
        )
        sys.exit(2)

    except JobError as e:
        """
        We use this exception handler when a job fails in Delphix so
        that we have actionable data
        """
        print("A job failed in the Delphix Engine:\n%s"(e.job))
        elapsed_minutes = time_elapsed()
        print_info(
            "%s took %s minutes to get this far"
            % (basename(__file__), str(elapsed_minutes))
        )
        sys.exit(3)

    except KeyboardInterrupt:
        """
        We use this exception handler to gracefully handle ctrl+c exits
        """
        print_debug("You sent a CTRL+C to interrupt the process")
        elapsed_minutes = time_elapsed()
        print_info(
            "%s took %s minutes to get this far"
            % (basename(__file__), str(elapsed_minutes))
        )

    except:
        """
        Everything else gets caught here
        """
        print (sys.exc_info()[0])
        print (traceback.format_exc())
        elapsed_minutes = time_elapsed()
        print_info(
            "%s took %s minutes to get this far"
            % (basename(__file__), str(elapsed_minutes))
        )
        sys.exit(1)
def main(argv):
    #We want to be able to call on these variables anywhere in the script.
    global single_thread
    global usebackup
    global time_start
    global config_file_path
    global database_name
    global host_name
    global dx_session_obj
    global debug

    try:
        dx_session_obj = GetSession()
        debug = arguments['--debug']
        logging_est(arguments['--logdir'], debug)
        print_debug(arguments, debug)
        time_start = time()
        single_thread = False
        config_file_path = arguments['--config']

        print_info('Welcome to %s version %s' % (basename(__file__), 
                   VERSION))

        #Parse the dxtools.conf and put it into a dictionary
        dx_session_obj.get_config(config_file_path)


        database_name = arguments['--target']
        host_name = arguments['--environment']

        #This is the function that will handle processing main_workflow for 
        # all the servers.
        run_job()
        
        elapsed_minutes = time_elapsed()
        print_info('script took %s minutes to get this far. ' %
                   (str(elapsed_minutes)))

    #Here we handle what we do when the unexpected happens
    except SystemExit as e:
        """
        This is what we use to handle our sys.exit(#)
        """
        sys.exit(e)

    except DlpxException as e:
        """
        We use this exception handler when an error occurs in a function call.
        """

        print('\nERROR: Please check the ERROR message below:\n%s' %
              (e.message))
        sys.exit(2)

    except HttpError as e:
        """
        We use this exception handler when our connection to Delphix fails
        """
        print('\nERROR: Connection failed to the Delphix Engine. Please '
              'check the ERROR message below:\n%s' % (e.message))
        sys.exit(2)

    except JobError as e:
        """
        We use this exception handler when a job fails in Delphix so 
        that we have actionable data
        """
        print 'A job failed in the Delphix Engine:\n%s' (e.job)
        elapsed_minutes = time_elapsed()
        print_info('%s took %s minutes to get this far' % (basename(__file__),
                   str(elapsed_minutes)))
        sys.exit(3)

    except KeyboardInterrupt:
        """
        We use this exception handler to gracefully handle ctrl+c exits
        """
        print_debug('You sent a CTRL+C to interrupt the process')
        elapsed_minutes = time_elapsed()
        print_info('%s took %s minutes to get this far' % (basename(__file__),
                   str(elapsed_minutes)))

    except:
        """
        Everything else gets caught here
        """
        print(sys.exc_info()[0])
        print(traceback.format_exc())
        elapsed_minutes = time_elapsed()
        print_info('%s took %s minutes to get this far' % (basename(__file__),
                   str(elapsed_minutes)))
        sys.exit(1)