Print the Compute usage quota for a specific region
506163
def print_region_quota(access_token, sub_id, region):
    ''''''
    print(region + ':')
    quota = azurerm.get_compute_usage(access_token, sub_id, region)
    if SUMMARY is False:
        print(json.dumps(quota, sort_keys=False, indent=2, separators=(',', ': ')))
    try:
        for resource in quota['value']:
            if resource['name']['value'] == 'cores':
                print('   Current: ' + str(resource['currentValue']) + ', limit: '
                      + str(resource['limit']))
                break
    except KeyError:
        print('Invalid data for region: ' + region)
656816
def print_usage():
    

    print('Usage: ' + os.path.basename(sys.argv[0]) + ' [options] dimacs-file')
    print('Options:')
    print('        -h, --help       Show this message')
    print('        -m, --model      Print model')
    print('        -s, --solver     SAT solver to use')
    print('                         Available values: g3, g4, m22, mgh (default = g4)')
    print('        -v, --verbose    Be verbose')
901136
private static void printUsage(String cmd) {
    String prefix = "Usage: java " + FairSchedulerShell.class.getSimpleName();
    if ("-getfsmaxslots".equalsIgnoreCase(cmd)) {
      System.err.println(prefix + " [-getfsmaxslots trackerName1, trackerName2 ... ]");
    } else if ("-setfsmaxslots".equalsIgnoreCase(cmd)) {
      System.err.println(prefix + " [-setfsmaxslots trackerName #maps #reduces trackerName2 #maps #reduces ... ]");
    } else {
      System.err.println(prefix);
      System.err.println("          [-setfsmaxslots trackerName #maps #reduces trackerName2 #maps #reduces ... ]");
      System.err.println("          [-getfsmaxslots trackerName1, trackerName2 ... ]");
      System.err.println("          [-resetfsmaxslots]");
      System.err.println("          [-help [cmd]]");
      System.err.println();
      ToolRunner.printGenericCommandUsage(System.err);
    }
  }
1130140
def idle_task(self):
        ''''''
        now = time.time()

        if now-self.last_sent > self.system_time_settings.interval:
            self.last_sent = now
            time_us = time.time() * 1000000
            if self.system_time_settings.verbose:
                print("ST: Sending system time: (%u/%u)" %
                      (time_us, self.uptime(),))
            self.master.mav.system_time_send(time_us,
                                             self.uptime())

        if (now-self.last_sent_timesync >
            self.system_time_settings.interval_timesync):
            self.last_sent_timesync = now
            time_ns = time.time() * 1000000000
            time_ns += 1234
            if self.system_time_settings.verbose:
                print("ST: Sending timesync request")
            self.master.mav.timesync_send(0, time_ns)
            self.last_sent_ts1 = time_ns
101743
def dbg_print(self):
        
        for region_id, region in self.regions.items():
            print("Region [%s]:" % region_id)
            region.dbg_print(indent=2)
162301
def printStack(self,wrappedStack,include=None,filters=["*"]):
        """"""
        rawStack = wrappedStack['rawStack']
        print "==== Stack {} ====".format(rawStack.name)
        print "Status: {} {}".format(rawStack.stack_status,defaultify(rawStack.stack_status_reason,''))

        for resourceType, resources in wrappedStack['resourcesByTypeIndex'].items():
            if resourceType in AwsProcessor.resourceTypeAliases:
                resourceType = AwsProcessor.resourceTypeAliases[resourceType];
            if (None == include or resourceType in include) and len(resources):
                print "== {}:".format(resourceType)
                logicalIdWidth = 1
                resourceStatusWidth = 1
                resourceStatusReasonWidth = 1
                for index, resource in resources.items():
                    logicalIdWidth = max(logicalIdWidth,len(resource.logical_id))
                    resourceStatusWidth = min(50,max(resourceStatusWidth,len(resource.resource_status)))
                    resourceStatusReasonWidth = min(50,max(resourceStatusReasonWidth,len(defaultify(resource.resource_status_reason,''))))
                frm = "    {{0:3d}}: {{1:{0}}} {{2:{1}}} {{3}}".format(logicalIdWidth,resourceStatusWidth)
                for index, resource in resources.items():
                    if fnmatches(resource.logical_id.lower(),filters):
                        print frm.format(index,resource.logical_id,
                                         elipsifyMiddle(repr(resource.resource_status),50),
                                         elipsifyMiddle(repr(defaultify(resource.resource_status_reason,'')),150))
245171
private void printWorkerInfo(List<WorkerInfo> workerInfoList) {
    mIndentationLevel = 0;
    if (mCapacityTierInfoMap.size() == 0) {
      return;
    } else if (mCapacityTierInfoMap.size() == 1) {
      // Do not print Total value when only one tier exists
      printShortWorkerInfo(workerInfoList);
      return;
    }
    Set<String> tiers = mCapacityTierInfoMap.keySet();
    String tiersInfo = String.format(Strings.repeat("%-14s", tiers.size()), tiers.toArray());
    String longInfoFormat = getInfoFormat(workerInfoList, false);
    print(String.format("%n" + longInfoFormat,
        "Worker Name", "Last Heartbeat", "Storage", "Total", tiersInfo));

    for (WorkerInfo info : workerInfoList) {
      String workerName = info.getAddress().getHost();

      long usedBytes = info.getUsedBytes();
      long capacityBytes = info.getCapacityBytes();

      String usedPercentageInfo = "";
      if (capacityBytes != 0) {
        int usedPercentage = (int) (100L * usedBytes / capacityBytes);
        usedPercentageInfo = String.format(" (%s%%)", usedPercentage);
      }

      String capacityTierInfo = getWorkerFormattedTierValues(mCapacityTierInfoMap, workerName);
      String usedTierInfo = getWorkerFormattedTierValues(mUsedTierInfoMap, workerName);

      print(String.format(longInfoFormat, workerName, info.getLastContactSec(), "capacity",
          FormatUtils.getSizeFromBytes(capacityBytes), capacityTierInfo));
      print(String.format(longInfoFormat, "", "", "used",
          FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, usedTierInfo));
    }
  }
932331
def get_quota(self):
		''
		du, ds = op.itemgetter('space_used', 'space_amount')\
			((yield super(txBox, self).info_user()))
		defer.returnValue((ds - du, ds))
469925
private static void printUsage(String cmd) {
    if ("-refreshServiceAcl".equals(cmd)) {
      System.err.println("Usage: java MRAdmin" + " [-refreshServiceAcl]");
    } else if ("-refreshQueueAcls".equals(cmd)) {
      System.err.println("Usage: java MRAdmin" + " [-refreshQueueAcls]");
    } else if ("-refreshNodes".equals(cmd)) {
      System.err.println("Usage: java MRAdmin" + " [-refreshNodes]");
    } else {
      System.err.println("Usage: java MRAdmin");
      System.err.println("           [-refreshServiceAcl]");
      System.err.println("           [-refreshQueueAcls]");
      System.err.println("           [-refreshNodes]");
      System.err.println("           [-help [cmd]]");
      System.err.println();
      ToolRunner.printGenericCommandUsage(System.err);
    }
  }
1030600
def _find_usage_instances(self):
        """"""
        # update our limits with usage
        inst_usage = self._instance_usage()
        res_usage = self._get_reserved_instance_count()
        logger.debug('Reserved instance count: %s', res_usage)
        total_ris = 0
        running_ris = 0
        # subtract reservations from instance usage
        ondemand_usage = defaultdict(int)
        for az in inst_usage:
            if az not in res_usage:
                for i_type, count in inst_usage[az].items():
                    ondemand_usage[i_type] += count
                continue
            # else we have reservations for this AZ
            for i_type, count in inst_usage[az].items():
                if i_type not in res_usage[az]:
                    # no reservations for this type
                    ondemand_usage[i_type] += count
                    continue
                od = count - res_usage[az][i_type]
                total_ris += res_usage[az][i_type]
                if count < res_usage[az][i_type]:
                    running_ris += count
                else:
                    running_ris += res_usage[az][i_type]
                if od < 0:
                    # we have unused reservations
                    continue
                ondemand_usage[i_type] += od
        logger.debug(
            'Found %d total RIs and %d running/used RIs',
            total_ris, running_ris
        )
        total_instances = 0
        for i_type, usage in ondemand_usage.items():
            key = 'Running On-Demand {t} instances'.format(
                t=i_type)
            self.limits[key]._add_current_usage(
                usage,
                aws_type='AWS::EC2::Instance',
            )
            total_instances += usage
        # limit for ALL On-Demand EC2 instances
        key = 'Running On-Demand EC2 instances'
        self.limits[key]._add_current_usage(
            total_instances,
            aws_type='AWS::EC2::Instance'
        )
985433
def printProfile(self, reset=False):
    
    print "Profiling information for {}".format(type(self).__name__)
    totalTime = 0.000001
    for region in self.network.regions.values():
      timer = region.getComputeTimer()
      totalTime += timer.getElapsed()

    # Sort the region names
    regionNames = list(self.network.regions.keys())
    regionNames.sort()

    count = 1
    profileInfo = []
    L2Time = 0.0
    L4Time = 0.0
    for regionName in regionNames:
      region = self.network.regions[regionName]
      timer = region.getComputeTimer()
      count = max(timer.getStartCount(), count)
      profileInfo.append([region.name,
                          timer.getStartCount(),
                          timer.getElapsed(),
                          100.0 * timer.getElapsed() / totalTime,
                          timer.getElapsed() / max(timer.getStartCount(), 1)])
      if "L2Column" in regionName:
        L2Time += timer.getElapsed()
      elif "L4Column" in regionName:
        L4Time += timer.getElapsed()

    profileInfo.append(
      ["Total time", "", totalTime, "100.0", totalTime / count])
    print tabulate(profileInfo, headers=["Region", "Count",
                                         "Elapsed", "Pct of total",
                                         "Secs/iteration"],
                   tablefmt="grid", floatfmt="6.3f")
    print
    print "Total time in L2 =", L2Time
    print "Total time in L4 =", L4Time

    if reset:
      self.resetProfile()
396829
def _print(self, force_flush=False):
        
        self._stream_flush()
        next_perc = self._calc_percent()
        if self.update_interval:
            do_update = time.time() - self.last_time >= self.update_interval
        elif force_flush:
            do_update = True
        else:
            do_update = next_perc > self.last_progress

        if do_update and self.active:
            self.last_progress = next_perc
            self._cache_percent_indicator(self.last_progress)
            if self.track:
                self._cached_output += ' Time elapsed: ' + \
                                       self._get_time(self._elapsed())
                self._cache_eta()
            if self.item_id:
                self._cache_item_id()
            self._stream_out('\r%s' % self._cached_output)
            self._stream_flush()
            self._cached_output = ''
763310
def _print_if_needed(self):
        """"""
        if self._in_txn or self.print_frequency is None:
            return
        elif self.last_export is not None and \
             self.last_export + self.print_frequency > time.time():
            return

        self.export()
1136643
def iterate_specific_packet_range():
    """"""
    now = datetime.utcnow()
    start = now - timedelta(hours=1)

    total = 0
    for packet in archive.list_packets(start=start, stop=now):
        total += 1
        # print(packet)
    print('Found', total, 'packets in range')
985017
def usage(self):
    """"""
    print self.programName + " [options]",
    if self.maxArgs == -1 or self.maxArgs - self.minArgs > 1:
      print "[files..]"
    elif self.maxArgs - self.minArgs == 1:
      print "[file]"
    print

    print self.shortDescription

    print "Options:"
    for o in self.options:
      print "\t", ("-" + o.short + ", --" + o.long).ljust(15), ":",
      print o.description.replace("\t", "\\t").ljust(80)
909789
public static void printMountInfo(Map<String, MountPointInfo> mountTable) {
    for (Map.Entry<String, MountPointInfo> entry : mountTable.entrySet()) {
      String mMountPoint = entry.getKey();
      MountPointInfo mountPointInfo = entry.getValue();

      long capacityBytes = mountPointInfo.getUfsCapacityBytes();
      long usedBytes = mountPointInfo.getUfsUsedBytes();

      String usedPercentageInfo = "";
      if (capacityBytes > 0) {
        int usedPercentage = (int) (100L * usedBytes / capacityBytes);
        usedPercentageInfo = String.format("(%s%%)", usedPercentage);
      }

      String leftAlignFormat = getAlignFormat(mountTable);

      System.out.format(leftAlignFormat, mountPointInfo.getUfsUri(), mMountPoint,
          mountPointInfo.getUfsType(), FormatUtils.getSizeFromBytes(capacityBytes),
          FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo,
          mountPointInfo.getReadOnly() ? "" : "not ",
          mountPointInfo.getShared() ? "" : "not ");
      System.out.println("properties=" + mountPointInfo.getProperties() + ")");
    }
  }
995103
private void printLirs() {
    System.out.println("** LIRS stack TOP **");
    for (Node n = headS.nextS; n != headS; n = n.nextS) {
      checkState(n.isInS);
      if (n.status == Status.HIR_NON_RESIDENT) {
        System.out.println("<NR> " + n.key);
      } else if (n.status == Status.HIR_RESIDENT) {
        System.out.println("<RH> " + n.key);
      } else {
        System.out.println("<RL> " + n.key);
      }
    }
    System.out.println("** LIRS stack BOTTOM **");

    System.out.println("\n** LIRS queue END **");
    for (Node n = headQ.nextQ; n != headQ; n = n.nextQ) {
      checkState(n.isInQ);
      System.out.println(n.key);
    }
    System.out.println("** LIRS queue front **");

    System.out.println("\nLIRS EVICTED PAGE sequence:");
    for (int i = 0; i < evicted.size(); i++) {
      System.out.println("<" + i + "> " + evicted.get(i));
    }
  }