Search in sources :

Example 6 with JobMasterClient

use of alluxio.client.job.JobMasterClient in project alluxio by Alluxio.

the class TableMasterFactory method create.

@Override
public TableMaster create(MasterRegistry registry, CoreMasterContext context) {
    LOG.info("Creating {} ", TableMaster.class.getName());
    JobMasterClient jobMasterClient = JobMasterClient.Factory.create(JobMasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).build());
    TableMaster master = new DefaultTableMaster(context, jobMasterClient);
    registry.add(TableMaster.class, master);
    return master;
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient)

Example 7 with JobMasterClient

use of alluxio.client.job.JobMasterClient in project alluxio by Alluxio.

the class StatCommand method run.

@Override
public int run(CommandLine cl) throws AlluxioException, IOException {
    long id = Long.parseLong(cl.getArgs()[0]);
    try (CloseableResource<JobMasterClient> client = JobContext.create(mFsContext.getClusterConf(), mFsContext.getClientContext().getUserState()).acquireMasterClientResource()) {
        JobInfo info = client.get().getJobStatusDetailed(id);
        System.out.print(formatOutput(cl, info));
    } catch (Exception e) {
        LOG.error("Failed to get status of the job", e);
        System.out.println("Failed to get status of the job " + id);
        return -1;
    }
    return 0;
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient) JobInfo(alluxio.job.wire.JobInfo) AlluxioException(alluxio.exception.AlluxioException) IOException(java.io.IOException) InvalidArgumentException(alluxio.exception.status.InvalidArgumentException)

Example 8 with JobMasterClient

use of alluxio.client.job.JobMasterClient in project alluxio by Alluxio.

the class LogLevelTest method parseZooKeeperHAJobMasterTarget.

@Test
public void parseZooKeeperHAJobMasterTarget() throws Exception {
    mConf.set(PropertyKey.ZOOKEEPER_ENABLED, true);
    mConf.set(PropertyKey.ZOOKEEPER_ADDRESS, "masters-1:2181");
    CommandLine mockCommandLine = mock(CommandLine.class);
    String[] mockArgs = new String[] { "--target", "job_master" };
    when(mockCommandLine.getArgs()).thenReturn(mockArgs);
    when(mockCommandLine.hasOption(LogLevel.TARGET_OPTION_NAME)).thenReturn(true);
    when(mockCommandLine.getOptionValue(LogLevel.TARGET_OPTION_NAME)).thenReturn(mockArgs[1]);
    PowerMockito.mockStatic(JobMasterClient.Factory.class);
    JobMasterClient mockJobClient = mock(JobMasterClient.class);
    when(mockJobClient.getAddress()).thenReturn(new InetSocketAddress("masters-2", mConf.getInt(PropertyKey.JOB_MASTER_RPC_PORT)));
    when(JobMasterClient.Factory.create(any())).thenReturn(mockJobClient);
    List<LogLevel.TargetInfo> targets = LogLevel.parseOptTarget(mockCommandLine, mConf);
    assertEquals(1, targets.size());
    assertEquals(new LogLevel.TargetInfo("masters-2", JOB_MASTER_WEB_PORT, "job_master"), targets.get(0));
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient) CommandLine(org.apache.commons.cli.CommandLine) InetSocketAddress(java.net.InetSocketAddress) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 9 with JobMasterClient

use of alluxio.client.job.JobMasterClient in project alluxio by Alluxio.

the class LogLevelTest method parseEmbeddedHAJobMasterTarget.

@Test
public void parseEmbeddedHAJobMasterTarget() throws Exception {
    mConf.set(PropertyKey.JOB_MASTER_EMBEDDED_JOURNAL_ADDRESSES, "masters-1:19200,masters-2:19200");
    CommandLine mockCommandLine = mock(CommandLine.class);
    String[] mockArgs = new String[] { "--target", "job_master" };
    when(mockCommandLine.getArgs()).thenReturn(mockArgs);
    when(mockCommandLine.hasOption(LogLevel.TARGET_OPTION_NAME)).thenReturn(true);
    when(mockCommandLine.getOptionValue(LogLevel.TARGET_OPTION_NAME)).thenReturn(mockArgs[1]);
    PowerMockito.mockStatic(JobMasterClient.Factory.class);
    JobMasterClient mockJobClient = mock(JobMasterClient.class);
    when(mockJobClient.getAddress()).thenReturn(new InetSocketAddress("masters-2", mConf.getInt(PropertyKey.JOB_MASTER_RPC_PORT)));
    when(JobMasterClient.Factory.create(any())).thenReturn(mockJobClient);
    List<LogLevel.TargetInfo> targets = LogLevel.parseOptTarget(mockCommandLine, mConf);
    assertEquals(1, targets.size());
    assertEquals(new LogLevel.TargetInfo("masters-2", JOB_MASTER_WEB_PORT, "job_master"), targets.get(0));
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient) CommandLine(org.apache.commons.cli.CommandLine) InetSocketAddress(java.net.InetSocketAddress) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

JobMasterClient (alluxio.client.job.JobMasterClient)9 ArrayList (java.util.ArrayList)4 InstancedConfiguration (alluxio.conf.InstancedConfiguration)3 IOException (java.io.IOException)3 CommandLine (org.apache.commons.cli.CommandLine)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 JobWorkerHealth (alluxio.job.wire.JobWorkerHealth)2 InetSocketAddress (java.net.InetSocketAddress)2 ClientContext (alluxio.ClientContext)1 BlockWorkerInfo (alluxio.client.block.BlockWorkerInfo)1 FileSystemContext (alluxio.client.file.FileSystemContext)1 AlluxioException (alluxio.exception.AlluxioException)1 InvalidArgumentException (alluxio.exception.status.InvalidArgumentException)1 JobInfo (alluxio.job.wire.JobInfo)1 JobServiceMaxThroughputSummary (alluxio.stress.jobservice.JobServiceMaxThroughputSummary)1 MasterBenchSummary (alluxio.stress.master.MasterBenchSummary)1 MaxThroughputSummary (alluxio.stress.master.MaxThroughputSummary)1 WorkerNetAddress (alluxio.wire.WorkerNetAddress)1 JobMasterClientContext (alluxio.worker.job.JobMasterClientContext)1