Example #1
0
    def start(self, env):
        import params
        self.configure(env)

        pids = [{
            'pidfile': pidfile,
            'running': False
        } for pidfile in params.segment_pids]

        print 'Waiting for', str(len(pids)), 'segments to start.',

        while True:
            stopped_pids = [pid for pid in pids if not pid['running']]

            if len(stopped_pids) == 0:
                break

            for pid in stopped_pids:
                pid['running'] = greenplum.is_running(pid['pidfile'])

            time.sleep(1)
            sys.stdout.write('.')

        print
        if all([pid['running'] == True for pid in pids]):
            print "All segments on host started."
        else:
            raise RuntimeError("Not all segments on host started!")
Example #2
0
    def stop(self, env):
        import params

        pids = [{
            'pidfile': pidfile,
            'running': True
        } for pidfile in params.segment_pids]

        print 'Waiting for', str(len(pids)), 'segments to stop.',

        while True:
            running_pids = [pid for pid in pids if pid['running']]

            if len(running_pids) == 0:
                break

            for pid in running_pids:
                pid['running'] = greenplum.is_running(pid['pidfile'])

            time.sleep(1)
            sys.stdout.write('.')

        print
        if all([pid['running'] == False for pid in pids]):
            print "All segments on host stopped."
        else:
            raise RuntimeError("Error stopping all segments!")
Example #3
0
    def status(self, env):
        import params
        from glob import glob

        # Given an array of globs, loop through each pid file which matches any of the globs and
        # verify the pid it references is running.
        for pid_path in [pid_path for pid_glob in params.segment_pid_globs for pid_path in glob(path.dirname(pid_glob))]:
            if not greenplum.is_running(path.join(pid_path, path.basename(pid_glob))):
                raise ComponentIsNotRunning()
Example #4
0
    def stop(self, env):
        import params

        if not greenplum.is_running(params.master_pid_path):
            print "Greenplum is not running."
            return

        Execute(
            params.source_cmd + "gpstop -a -M smart -v",
            user=params.admin_user
        )
Example #5
0
 def status(self, env):
     import params
     if not greenplum.is_running(params.master_pid_path):
         raise ComponentIsNotRunning()
Example #6
0
 def stop(self, env):
     import params
     import time
     while greenplum.is_running(params.master_pid_path):
         sys.stdout.write('.')
         time.sleep(1)