Example #1
0
 def tail_file(self, file_uuid, num_lines=10):
     '''
     Read the last num_lines lines from the given file uuid.
     Return an empty buffer if and only if this file handle is at EOF.
     '''
     file_handle = self.file_handles[file_uuid]
     return xmlrpclib.Binary(file_util.tail(file_handle));
    def tail_file(self, target):
        (bundle_spec, subpath) = target
        file_handle = self.open_target(target)

        with contextlib.closing(file_handle):
            # Print last 10 lines
            tail = file_util.tail(file_handle)
            print tail

            def read_line():
                return file_handle.readline()

            return self.watch(bundle_spec, [read_line])