Esempio n. 1
0
 def get_directory_size(self, path):
     try:
         result = fs.read_dir_aggregates(self.connection,
                                         self.credentials,
                                         path=path)
     except qumulo.lib.request.RequestError, excpt:
         sys.exit(1)
Esempio n. 2
0
 def get_aggregates(self, path, aggregate):
     start = time.time()
     res = fs.read_dir_aggregates(self.connection,
                                  self.creds,
                                  path=path,
                                  order_by=QUERY_ORDER_BY[aggregate],
                                  max_entries=5000)
     print("Read directory aggregates in %7.3f seconds at path " %
           (time.time() - start, path))
     return res
Esempio n. 3
0
def find_in_dirs(currdir, monthago):
    size_sge = {}
    subsizes = {}
    sublfs = {}
    dmtime = arrow.get(
        fs.get_file_attr(conninfo, creds,
                         currdir["path"])[0]["modification_time"])
    if currdir["name"] in ("sge_error", "sge_output") and monthago > dmtime:
        d = fs.read_dir_aggregates(conninfo, creds, currdir["path"])
        size_sge[d[0]["path"]] = d[0]["total_data"]
    else:
        subdirs, sublfs = get_dir_info(conninfo, creds, currdir["path"],
                                       monthago)
        subsizes = parsedirs(subdirs, monthago)
    curr_pathsizes = merge_dicts(size_sge, subsizes, sublfs)
    return curr_pathsizes
Esempio n. 4
0
def du(conn, credentials, path, verbose=False):
    'Prints out capacity usage for the directory.'
    response = fs.read_dir_aggregates(conn, credentials, path.remote())[0]
    size = metricize(int(response['total_capacity']), 'B')

    mypath = path.remote()
    if path.complete:
        mypath = path.local()

    if verbose:
        print('{0: >10s}    {1}'.format(bold(size), mypath))

        filecount = metricize(int(response['total_files']))
        dircount = metricize(int(response['total_directories']))
        print('    {0} files, {1} directories'.format(filecount, dircount))
    else:
        print('{0: >10s}    {1}'.format(bold(size), mypath))
Esempio n. 5
0
    def get_directory_size(self, path):
        try:
            result = fs.read_dir_aggregates(self.connection, 
                                            self.credentials,
                                            path=path, 
                                            snapshot=self.snap['id'] if self.snap is not None else None)
        except qumulo.lib.request.RequestError as excpt:
            print(sys.exc_info())
            sys.exit(1)

        sz = int(result.data['total_capacity'])
        if self.agg_type == 'files':
            sz = int(result.data['total_files']) \
                + int(result.data['total_other_objects']) \
                + int(result.data['total_symlinks']) \
                + int(result.data['total_directories'])
        return sz
Esempio n. 6
0
 def main(conninfo, credentials, args):
     print fs.read_dir_aggregates(conninfo, credentials, args.path,
             args.recursive, args.max_entries, args.max_depth, args.order_by)
Esempio n. 7
0
 def get_directory_size(self, path):
     try:
         result = fs.read_dir_aggregates(self.connection, self.credentials,
                                         path=path)
     except qumulo.lib.request.RequestError, excpt:
         sys.exit(1)