Search in sources :

Example 6 with RuntimeDataMBean

use of org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBean in project scheduling by ow2-proactive.

the class SchedulerRuntimeDataMBeanTest method checkJobData.

private void checkJobData(RuntimeDataMBean bean, JobId jobId) throws Exception {
    JobState jobState = schedulerHelper.getSchedulerInterface().getJobState(jobId);
    long pendingTime = bean.getJobPendingTime(jobId.value());
    long runningTime = bean.getJobRunningTime(jobId.value());
    assertEquals("Unexpected pending time", jobState.getStartTime() - jobState.getSubmittedTime(), pendingTime);
    assertEquals("Unexpected running time", jobState.getFinishedTime() - jobState.getStartTime(), runningTime);
    assertEquals("Unexpected nodes number", 1, bean.getTotalNumberOfNodesUsed(jobId.value()));
    bean.getMeanTaskPendingTime(jobId.value());
    bean.getMeanTaskRunningTime(jobId.value());
}
Also used : JobState(org.ow2.proactive.scheduler.common.job.JobState)

Example 7 with RuntimeDataMBean

use of org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBean in project scheduling by ow2-proactive.

the class SchedulerRuntimeDataMBeanTest method testAsAdmin.

private void testAsAdmin() throws Exception {
    final SchedulerAuthenticationInterface auth = schedulerHelper.getSchedulerAuth();
    final HashMap<String, Object> env = new HashMap<>(1);
    env.put(JMXConnector.CREDENTIALS, new Object[] { TestUsers.DEMO.username, TestUsers.DEMO.password });
    JMXConnector adminJmxConnector = JMXConnectorFactory.connect(new JMXServiceURL(auth.getJMXConnectorURL(JMXTransportProtocol.RMI)), env);
    List<JobInfo> existingFinishedJobs = schedulerHelper.getSchedulerInterface().getJobs(0, 1000, new JobFilterCriteria(false, false, true, true), null).getList();
    int nbFinishedTasks = 0;
    int nbTotalTasks = 0;
    for (JobInfo existingFinishedJob : existingFinishedJobs) {
        nbFinishedTasks += existingFinishedJob.getNumberOfFinishedTasks();
        nbTotalTasks += existingFinishedJob.getTotalNumberOfTasks();
    }
    try {
        MBeanServerConnection connection = adminJmxConnector.getMBeanServerConnection();
        final ObjectName beanName = new ObjectName(SchedulerJMXHelper.RUNTIMEDATA_MBEAN_NAME);
        RuntimeDataMBean bean = JMX.newMXBeanProxy(connection, beanName, RuntimeDataMBean.class);
        checkDataConsistent(bean);
        JobId jobId;
        jobId = schedulerHelper.submitJob(createJobWithFailingTask());
        schedulerHelper.waitForEventTaskWaitingForRestart(jobId, "task1");
        checkDataConsistent(bean);
        schedulerHelper.waitForEventTaskWaitingForRestart(jobId, "task1");
        checkDataConsistent(bean);
        schedulerHelper.waitForEventJobFinished(jobId, 60000);
        checkDataConsistent(bean);
        checkTasksData(bean, 0, 0, 1 + nbFinishedTasks, 1 + nbTotalTasks);
        checkJobData(bean, jobId);
        jobId = schedulerHelper.submitJob(createJobWithMultinodeTask(100));
        Thread.sleep(5000);
        checkDataConsistent(bean);
        checkTasksData(bean, 1, 0, 1 + nbFinishedTasks, 2 + nbTotalTasks);
        schedulerHelper.getSchedulerInterface().killJob(jobId);
        checkDataConsistent(bean);
        checkTasksData(bean, 0, 0, 1 + nbFinishedTasks, 2 + nbTotalTasks);
    } finally {
        adminJmxConnector.close();
    }
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) JobFilterCriteria(org.ow2.proactive.scheduler.common.JobFilterCriteria) HashMap(java.util.HashMap) SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface) RuntimeDataMBean(org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBean) ObjectName(javax.management.ObjectName) JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) JMXConnector(javax.management.remote.JMXConnector) MBeanServerConnection(javax.management.MBeanServerConnection) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Aggregations

ObjectName (javax.management.ObjectName)4 HashMap (java.util.HashMap)3 JMXConnector (javax.management.remote.JMXConnector)3 JMXServiceURL (javax.management.remote.JMXServiceURL)3 SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)3 File (java.io.File)2 MBeanServerConnection (javax.management.MBeanServerConnection)2 StandardMBean (javax.management.StandardMBean)2 RRDDataStore (org.ow2.proactive.jmx.RRDDataStore)2 JobId (org.ow2.proactive.scheduler.common.job.JobId)2 RuntimeDataMBean (org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBean)2 PublicKey (java.security.PublicKey)1 Test (org.junit.Test)1 CredData (org.ow2.proactive.authentication.crypto.CredData)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 JMXClientHelper (org.ow2.proactive.jmx.JMXClientHelper)1 AllAccountsMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.AllAccountsMBeanImpl)1 ManagementMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.ManagementMBeanImpl)1 MyAccountMBeanImpl (org.ow2.proactive.resourcemanager.core.jmx.mbean.MyAccountMBeanImpl)1 RuntimeDataMBean (org.ow2.proactive.resourcemanager.core.jmx.mbean.RuntimeDataMBean)1