Tabnine Logo
WorkerInfo.getCapacityBytes
Code IndexAdd Tabnine to your IDE (free)

How to use
getCapacityBytes
method
in
alluxio.wire.WorkerInfo

Best Java code snippets using alluxio.wire.WorkerInfo.getCapacityBytes (Showing top 10 results out of 315)

origin: Alluxio/alluxio

/**
 * @return the info of all block workers
 */
public List<BlockWorkerInfo> getAllWorkers() throws IOException {
 try (CloseableResource<BlockMasterClient> masterClientResource =
   mContext.acquireBlockMasterClientResource()) {
  return masterClientResource.get().getWorkerInfoList().stream()
    .map(w -> new BlockWorkerInfo(w.getAddress(), w.getCapacityBytes(), w.getUsedBytes()))
    .collect(toList());
 }
}
origin: Alluxio/alluxio

for (WorkerInfo workerInfo : workerInfoList) {
 long usedBytes = workerInfo.getUsedBytes();
 long capacityBytes = workerInfo.getCapacityBytes();
 mSumCapacityBytes += capacityBytes;
 mSumUsedBytes += usedBytes;
origin: Alluxio/alluxio

long capacityBytes = info.getCapacityBytes();
origin: Alluxio/alluxio

/**
 * Converts wire type to proto type.
 *
 * @param workerInfo the wire representation to convert
 * @return the converted proto representation
 */
public static alluxio.grpc.WorkerInfo toProto(WorkerInfo workerInfo) {
 return alluxio.grpc.WorkerInfo.newBuilder().setId(workerInfo.getId())
   .setAddress(toProto(workerInfo.getAddress()))
   .setLastContactSec(workerInfo.getLastContactSec()).setState(workerInfo.getState())
   .setCapacityBytes(workerInfo.getCapacityBytes()).setUsedBytes(workerInfo.getUsedBytes())
   .setStartTimeMs(workerInfo.getStartTimeMs())
   .putAllCapacityBytesOnTiers(workerInfo.getCapacityBytesOnTiers())
   .putAllUsedBytesOnTiers(workerInfo.getUsedBytesOnTiers()).build();
}
origin: Alluxio/alluxio

/**
 * Prints worker information when only one tier exists.
 *
 * @param workerInfoList the worker info list to get info from
 */
private void printShortWorkerInfo(List<WorkerInfo> workerInfoList) {
 String tier = mCapacityTierInfoMap.firstKey();
 String shortInfoFormat = getInfoFormat(workerInfoList, true);
 print(String.format("%n" + shortInfoFormat,
   "Worker Name", "Last Heartbeat", "Storage", tier));
 for (WorkerInfo info : workerInfoList) {
  long capacityBytes = info.getCapacityBytes();
  long usedBytes = info.getUsedBytes();
  String usedPercentageInfo = "";
  if (capacityBytes != 0) {
   int usedPercentage = (int) (100L * usedBytes / capacityBytes);
   usedPercentageInfo = String.format(" (%s%%)", usedPercentage);
  }
  print(String.format(shortInfoFormat, info.getAddress().getHost(),
    info.getLastContactSec(), "capacity", FormatUtils.getSizeFromBytes(capacityBytes)));
  print(String.format(shortInfoFormat, "", "", "used",
    FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo));
 }
}
origin: Alluxio/alluxio

public void checkEquality(WorkerInfo a, WorkerInfo b) {
 Assert.assertEquals(a.getId(), b.getId());
 Assert.assertEquals(a.getAddress(), b.getAddress());
 Assert.assertEquals(a.getLastContactSec(), b.getLastContactSec());
 Assert.assertEquals(a.getCapacityBytes(), b.getCapacityBytes());
 Assert.assertEquals(a.getUsedBytes(), b.getUsedBytes());
 Assert.assertEquals(a.getStartTimeMs(), b.getStartTimeMs());
 Assert.assertEquals(a.getState(), b.getState());
 Assert.assertEquals(a.getCapacityBytesOnTiers(), b.getCapacityBytesOnTiers());
 Assert.assertEquals(a.getUsedBytesOnTiers(), b.getUsedBytesOnTiers());
 Assert.assertEquals(a, b);
}
origin: Alluxio/alluxio

/**
 * Instantiates a new Node info.
 *
 * @param workerInfo the worker info
 */
public NodeInfo(WorkerInfo workerInfo) {
 mHost = workerInfo.getAddress().getHost();
 mWebPort = workerInfo.getAddress().getWebPort();
 mLastContactSec = Integer.toString(workerInfo.getLastContactSec());
 mWorkerState = workerInfo.getState();
 mCapacityBytes = workerInfo.getCapacityBytes();
 mUsedBytes = workerInfo.getUsedBytes();
 if (mCapacityBytes != 0) {
  mUsedPercent = (int) (100L * mUsedBytes / mCapacityBytes);
 } else {
  mUsedPercent = 0;
 }
 mFreePercent = 100 - mUsedPercent;
 mUptimeClockTime =
   WebUtils.convertMsToShortClockTime(
     System.currentTimeMillis() - workerInfo.getStartTimeMs());
 mWorkerId = workerInfo.getId();
}
origin: Alluxio/alluxio

/**
 * Tests the {@link MasterWorkerInfo#generateWorkerInfo} method.
 */
@Test
public void workerInfoGeneration() {
 WorkerInfo workerInfo = mInfo.generateWorkerInfo(null, true);
 assertEquals(mInfo.getId(), workerInfo.getId());
 assertEquals(mInfo.getWorkerAddress(), workerInfo.getAddress());
 assertEquals("In Service", workerInfo.getState());
 assertEquals(mInfo.getCapacityBytes(), workerInfo.getCapacityBytes());
 assertEquals(mInfo.getUsedBytes(), workerInfo.getUsedBytes());
 assertEquals(mInfo.getStartTime(), workerInfo.getStartTimeMs());
}
origin: org.alluxio/alluxio-core-client-internal

/**
 * @return the info of all active block workers
 * @throws IOException when work info list cannot be obtained from master
 * @throws AlluxioException if network connection failed
 */
public List<BlockWorkerInfo> getWorkerInfoList() throws IOException, AlluxioException {
 List<BlockWorkerInfo> infoList = Lists.newArrayList();
 BlockMasterClient masterClient = mContext.acquireMasterClient();
 try {
  for (WorkerInfo workerInfo : masterClient.getWorkerInfoList()) {
   infoList.add(new BlockWorkerInfo(workerInfo.getAddress(), workerInfo.getCapacityBytes(),
     workerInfo.getUsedBytes()));
  }
  return infoList;
 } finally {
  mContext.releaseMasterClient(masterClient);
 }
}
origin: org.alluxio/alluxio-core-server-master

private NodeInfo(WorkerInfo workerInfo) {
 mHost = workerInfo.getAddress().getHost();
 mWebPort = workerInfo.getAddress().getWebPort();
 mLastContactSec = Integer.toString(workerInfo.getLastContactSec());
 mWorkerState = workerInfo.getState();
 mCapacityBytes = workerInfo.getCapacityBytes();
 mUsedBytes = workerInfo.getUsedBytes();
 if (mCapacityBytes != 0) {
  mUsedPercent = (int) (100L * mUsedBytes / mCapacityBytes);
 } else {
  mUsedPercent = 0;
 }
 mFreePercent = 100 - mUsedPercent;
 mUptimeClockTime =
   WebUtils.convertMsToShortClockTime(
     System.currentTimeMillis() - workerInfo.getStartTimeMs());
 mWorkerId = workerInfo.getId();
}
alluxio.wireWorkerInfogetCapacityBytes

Popular methods of WorkerInfo

  • getAddress
  • getUsedBytes
  • <init>
    Creates a new instance of WorkerInfo.
  • getId
  • setAddress
  • getLastContactSec
  • setId
  • getStartTimeMs
  • getState
  • setLastContactSec
  • setStartTimeMs
  • setState
  • setStartTimeMs,
  • setState,
  • getCapacityBytesOnTiers,
  • getUsedBytesOnTiers,
  • setCapacityBytes,
  • setCapacityBytesOnTiers,
  • setUsedBytes,
  • setUsedBytesOnTiers,
  • toThrift

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JList (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now