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;
}
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;
}
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));
}
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));
}
Aggregations