def test_valid_executable(self):
        """
        Test functionality of valid_executable function
        """

        binary = "/bin/ls"
        text = get_test_config("test_files/subscriptions.xml")
        missing = "./test_files/foo"

        self.assertFalse(validation.valid_executable(missing), "Non-existent file is not a valid executable")
        self.assertFalse(validation.valid_executable(text), "Text file is not a valid executable")
        self.assertTrue(validation.valid_executable(binary), "/bin/ls should be a valid binary")
Exemple #2
0
    def test_valid_executable(self):
        """
        Test functionality of valid_executable function
        """

        binary = "/bin/ls"
        text = get_test_config("test_files/subscriptions.xml")
        missing = "./test_files/foo"

        self.assertFalse(validation.valid_executable(missing),
                         "Non-existent file is not a valid executable")
        self.assertFalse(validation.valid_executable(text),
                         "Text file is not a valid executable")
        self.assertTrue(validation.valid_executable(binary),
                        "/bin/ls should be a valid binary")
    def set_default_jobmanager(self, default='fork'):
        """
        Set the default jobmanager

        Arguments:
        default - Indicates the default jobmanger, currently
                  either 'fork' or 'managed-fork'
        """
        self.log("JobManager.set_default_jobmanager started")

        gatekeeper_admin = "/usr/sbin/globus-gatekeeper-admin"
        if not validation.valid_executable(gatekeeper_admin):
            self.log("%s not found. Ensure the Globus Gatekeeper is installed." % gatekeeper_admin, level=logging.ERROR)
            return False

        if default == 'fork':
            self.log("Setting regular fork manager to be the default jobmanager")
            result = utilities.run_script([gatekeeper_admin,
                                           '-e',
                                           'jobmanager-fork-poll',
                                           '-n',
                                           'jobmanager'])
            if not result:
                self.log("Could not set the jobmanager-fork-poll to the default " +
                         "jobmanager",
                         level=logging.ERROR)
                return False
            result = utilities.run_script([gatekeeper_admin,
                                           '-e',
                                           'jobmanager-fork-poll',
                                           '-n',
                                           'jobmanager-fork'])
            if not result:
                self.log("Could not set the jobmanager-fork-poll to the default " +
                         "jobmanager",
                         level=logging.ERROR)
                return False
        elif default == 'managed-fork':
            self.log("Setting managed fork manager to be the default jobmanager")
            result = utilities.run_script([gatekeeper_admin,
                                           '-e',
                                           'jobmanager-managedfork',
                                           '-n',
                                           'jobmanager'])
            if not result:
                self.log("Could not set the jobmanager-managedfork to the default " +
                         "jobmanager",
                         level=logging.ERROR)
                return False
            result = utilities.run_script([gatekeeper_admin,
                                           '-e',
                                           'jobmanager-managedfork',
                                           '-n',
                                           'jobmanager-fork'])
            if not result:
                self.log("Could not set the jobmanager-managedfork to the default " +
                         "jobmanager",
                         level=logging.ERROR)
                return False
        else:
            self.log("Invalid jobamanger type specified as the default " +
                     "jobmanger: %s" % default,
                     level=logging.ERROR)
            return False

        self.log("JobManager.set_default_jobmanager completed")
        return True
Exemple #4
0
    def set_default_jobmanager(self, default='fork'):
        """
        Set the default jobmanager

        Arguments:
        default - Indicates the default jobmanger, currently
                  either 'fork' or 'managed-fork'
        """
        self.log("JobManager.set_default_jobmanager started")

        gatekeeper_admin = "/usr/sbin/globus-gatekeeper-admin"
        if not validation.valid_executable(gatekeeper_admin):
            self.log(
                "%s not found. Ensure the Globus Gatekeeper is installed." %
                gatekeeper_admin,
                level=logging.ERROR)
            return False

        if default == 'fork':
            self.log(
                "Setting regular fork manager to be the default jobmanager")
            result = utilities.run_script([
                gatekeeper_admin, '-e', 'jobmanager-fork-poll', '-n',
                'jobmanager'
            ])
            if not result:
                self.log(
                    "Could not set the jobmanager-fork-poll to the default " +
                    "jobmanager",
                    level=logging.ERROR)
                return False
            result = utilities.run_script([
                gatekeeper_admin, '-e', 'jobmanager-fork-poll', '-n',
                'jobmanager-fork'
            ])
            if not result:
                self.log(
                    "Could not set the jobmanager-fork-poll to the default " +
                    "jobmanager",
                    level=logging.ERROR)
                return False
        elif default == 'managed-fork':
            self.log(
                "Setting managed fork manager to be the default jobmanager")
            result = utilities.run_script([
                gatekeeper_admin, '-e', 'jobmanager-managedfork', '-n',
                'jobmanager'
            ])
            if not result:
                self.log(
                    "Could not set the jobmanager-managedfork to the default "
                    + "jobmanager",
                    level=logging.ERROR)
                return False
            result = utilities.run_script([
                gatekeeper_admin, '-e', 'jobmanager-managedfork', '-n',
                'jobmanager-fork'
            ])
            if not result:
                self.log(
                    "Could not set the jobmanager-managedfork to the default "
                    + "jobmanager",
                    level=logging.ERROR)
                return False
        else:
            self.log("Invalid jobamanger type specified as the default " +
                     "jobmanger: %s" % default,
                     level=logging.ERROR)
            return False

        self.log("JobManager.set_default_jobmanager completed")
        return True