Get free resources
177412
public static void getFreeSlots(Map<String, SupervisorInfo> supervisorInfos,
                                    StormClusterState stormClusterState) throws Exception {
        Map<String, Assignment> assignments = Cluster.get_all_assignment(stormClusterState, null);
        for (Entry<String, Assignment> entry : assignments.entrySet()) {
            Assignment assignment = entry.getValue();
            Set<ResourceWorkerSlot> workers = assignment.getWorkers();
            for (ResourceWorkerSlot worker : workers) {
                SupervisorInfo supervisorInfo = supervisorInfos.get(worker.getNodeId());
                if (supervisorInfo == null) {
                    // the supervisor is dead
                    continue;
                }
                supervisorInfo.getAvailableWorkerPorts().remove(worker.getPort());
            }
        }
    }
1328400
@Override
    protected void freeResource()
        throws EFapsException
    {
        try {
            if (!getConnection().isClosed()) {
                getConnection().close();
            }
        } catch (final SQLException e) {
            throw new EFapsException("Could not close", e);
        }
    }
757915
def get_resources(url, resource_class, params={})
      get(url, params).map do |result|
        resource_class.from_hash(result, client: self)
      end
    end
655850
def _load_resources(self):
        """"""

        for t in self.doc.find('Root.Table'):
            for c in t.find('Table.Column'):
                if c.get_value('datatype') == 'geometry':
                    c['transform'] = '^empty_str'
                    c['datatype'] = 'text'

        return super()._load_resources()
1103395
def get_resources(resources)
      # prefetch api resources, skip missing APIs
      resource_apis = apis(resources.map(&:apiVersion), prefetch_resources: true, skip_missing: true)

      # map each resource to excon request options, or nil if resource is not (yet) defined
      requests = resources.zip(resource_apis).map{ |resource, api_client|
        next nil unless api_client.api_resources?

        resource_client = api_client.client_for_resource(resource)

        {
          method: 'GET',
          path: resource_client.path(resource.metadata.name, namespace: resource.metadata.namespace),
          response_class: resource_client.resource_class
        }
      }

      # map non-nil requests to response objects, or nil for nil request options
      Util.compact_map(requests) { |reqs|
        @transport.requests(*reqs, skip_missing: true)
      }
    end
1258320
def free_shape(self, name, free=True, **kwargs):
        
        src = self.roi.get_source_by_name(name)
        self.free_source(name, free=free,
                         pars=shape_parameters[src['SpectrumType']],
                         **kwargs)
345696
def resource(self, name):
        
        for resource in self.resources():
            if resource.name.lower() == name.lower():
                return resource
        raise NotFound('Unable to find resource %s' % name)
290663
function fetchResource(t, callback) {
  if (isContinuation(t)) {
    convertContinuation(t, callback);
  } else {
    fetchViaHttp(t, callback);
  }
}
73778
async def get_resource(self, resource_id: int) -> dict:
        """"""
        resource = await self.request.get(
            join_path(self._base_path, str(resource_id))
        )
        self._sanitize_resource(self._get_to_actual_data(resource))
        return resource
982775
def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
        """"""
        r = self._http_resource('GET', resource, params=params)
        d_items = self._resource_deserialize(r.content.decode("utf-8"))

        items =  [obj.new_from_dict(item, h=self, **kwargs) for item in d_items]

        if map is None:
            map = KeyedListResource

        list_resource = map(items=items)
        list_resource._h = self
        list_resource._obj = obj
        list_resource._kwargs = kwargs

        return list_resource
398219
public void getResources(Vector<URL> resources, String name)
  {
    Path path;

    path = getPath(name);

    if (path != null && path.canRead()) {
      try {
        resources.add(path.getNetURL());
      } catch (Exception e) {
      }
    }
  }
437534
def get_info(self):
        ''''''
        if self._min_disk:
            for path in self._resource_paths:
                usage = psutil.disk_usage(path)

                yield ResourceInfo(path, usage.free, self._min_disk)

        if self._min_memory:
            usage = psutil.virtual_memory()

            yield ResourceInfo(None, usage.available, self._min_memory)
97778
def resources(self):
        """"""
        res = []
        for resource in self._resources:
            res = res + resource.resources()

        return res
150261
def resources():
    """"""
    ind_id = request.form['ind_id']

    upload_dir = os.path.abspath(app.config['UPLOAD_DIR'])
    req_file = request.files['file']
    filename = secure_filename(req_file.filename)
    file_path = os.path.join(upload_dir, filename)
    name = request.form['name'] or filename
    req_file.save(file_path)

    ind_obj = app.db.individual(ind_id)
    app.db.add_resource(name, file_path, ind_obj)
    return redirect(request.referrer)
833368
function resources(data) {
    var items = [],
        fid = schedule.functor(id),
        favailable = schedule.functor(available),
        freserve = schedule.functor(isNotReservable);

    for(var i = 0, len = data.length; i < len; i++) {
      var resource = data[i],
          rId = fid.call(this, resource, i),
          rAvailable = favailable.call(this, resource, i),
          rReserve = freserve.call(this, resource, i);

      items.push({id: rId, available: rAvailable, isNotReservable: rReserve});
    }

    return items;
  }
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
262885
def get_resources(cls):
        """"""
        my_plurals = resource_helper.build_plural_mappings(
            {}, RESOURCE_ATTRIBUTE_MAP)
        attributes.PLURALS.update(my_plurals)
        attr_map = RESOURCE_ATTRIBUTE_MAP
        ext_resources = resource_helper.build_resource_info(my_plurals,
                                                            attr_map,
                                                            constants.A10_CERTIFICATE)

        return ext_resources