01234567890123456789012345678901234567890123456789012345678901234567890123456789
13821383138413851386138713881389139013911392139313941395139613971398139914001401 1402140314041405 14061407140814091410141114121413141414151416141714181419142014211422142314241425 |
<----SKIPPED LINES---->
[os.path.join(directory, f) for f in files if pattern.match(f)])
else:
if os.path.exists(full_path):
files = [full_path]
else:
return []
data = []
if filenames:
return files
for file in files:
if heartbeat:
Heartbeat()
new_data = []
try:
with open(file, 'rb') as f:
while True:
try:
new_data.append(pickle.load(f))
except (UnicodeDecodeError) as e:
Log('Process %s reading file %s gave error %s' % (
psutil.Process(os.getpid()).name(), f, e))
except (EOFError, pickle.UnpicklingError):
pass
data.extend(new_data)
return data
cached_object_count = {}
def PickleObjectToFile(
data, full_path, date_segmentation, timestamp=None, verify=False):
"""Append one pickled flight to the end of binary file.
Args:
data: data to pickle
full_path: name (potentially including path) of the pickled file
date_segmentation: boolean indicating whether the date string yyyy-mm-dd
should be prepended to the file name in full_path based on the current
date, so that pickled files are segmented by date.
timestamp: if date_segmentation is True, this is used rather than system
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429 |
<----SKIPPED LINES---->
[os.path.join(directory, f) for f in files if pattern.match(f)])
else:
if os.path.exists(full_path):
files = [full_path]
else:
return []
data = []
if filenames:
return files
for file in files:
if heartbeat:
Heartbeat()
new_data = []
try:
with open(file, 'rb') as f:
while True:
try:
file_data = pickle.load(f)
new_data.append(file_data)
except (UnicodeDecodeError) as e:
Log('Process %s reading file %s gave error %s' % (
psutil.Process(os.getpid()).name(), f, e))
except (TypeError) as e:
Log('Process %s reading file %s gave error %s from %s' % (
psutil.Process(os.getpid()).name(), f, e, file_data))
except (EOFError, pickle.UnpicklingError):
pass
data.extend(new_data)
return data
cached_object_count = {}
def PickleObjectToFile(
data, full_path, date_segmentation, timestamp=None, verify=False):
"""Append one pickled flight to the end of binary file.
Args:
data: data to pickle
full_path: name (potentially including path) of the pickled file
date_segmentation: boolean indicating whether the date string yyyy-mm-dd
should be prepended to the file name in full_path based on the current
date, so that pickled files are segmented by date.
timestamp: if date_segmentation is True, this is used rather than system
<----SKIPPED LINES---->
|