Skip to content

Commit

Permalink
Initial pickle addition
Browse files Browse the repository at this point in the history
  • Loading branch information
ggatward committed Jul 31, 2016
1 parent bbb03f1 commit d8d3bd0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion sat_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Exports Default Org Content View.
"""

import sys, argparse, datetime, os, shutil
import sys, argparse, datetime, os, shutil, pickle
import fnmatch, subprocess, tarfile
import simplejson as json
from glob import glob
Expand Down Expand Up @@ -405,9 +405,16 @@ def read_timestamp(name):
last = None
for line in (line for line in f_handle if line.rstrip('\n')):
last = line.rstrip('\n')

return last


def read_pickle(name):
export_times = {}

return export_times


def main():
"""
Main Routine
Expand Down Expand Up @@ -480,6 +487,10 @@ def main():
# If we are given a start date, use that, otherwise we need to get the last date from file
# If there is no last export, we'll set an arbitrary start date to grab everything (2000-01-01)
last_export = read_timestamp(ename)

# Read the last export date pickle for our selected group
export_times = read_pickle(ename)

export_type = 'incr'

if args.all:
Expand Down Expand Up @@ -577,10 +588,18 @@ def main():
msg = "Export FAILED"
helpers.log_msg(msg, 'ERROR')

# Add repo export timestamp to repo_dict
export_times[repo_result['label']] = start_time

else:
msg = "Skipping " + repo_result['label']
helpers.log_msg(msg, 'DEBUG')

# DEBUG: Dump the export_times dictionary
print export_times
# TEMPORARY - Move to correct location post-debugging
pickle.dump(export_times, open('var/exports_' + name + '.pkl', "wb"))


# Combine resulting directory structures into a single repo format (top level = /content)
prep_export_tree(org_name)
Expand Down

0 comments on commit d8d3bd0

Please sign in to comment.