summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-10-11 18:52:19 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-10-11 18:52:19 +0000
commit65568e4fbf891d21edbb6f13cd3ed8455b0d9153 (patch)
treed28512c38a8e12746d9b6a7383773b2822d1c2c4 /src
parenta99a195893062d1ad0802f991aec084b5fd2538a (diff)
downloadbcfg2-65568e4fbf891d21edbb6f13cd3ed8455b0d9153.tar.gz
bcfg2-65568e4fbf891d21edbb6f13cd3ed8455b0d9153.tar.bz2
bcfg2-65568e4fbf891d21edbb6f13cd3ed8455b0d9153.zip
Make importscript even more efficient
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3795 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/Server/Reports/importscript.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/lib/Server/Reports/importscript.py b/src/lib/Server/Reports/importscript.py
index 33bca3e35..9f2a3254e 100755
--- a/src/lib/Server/Reports/importscript.py
+++ b/src/lib/Server/Reports/importscript.py
@@ -138,24 +138,12 @@ if __name__ == '__main__':
for node in statsdata.findall('Node'):
name = node.get('name')
c_inst = Client.objects.filter(id=clients[name])[0]
- last_time = Interaction.objects.filter(client=c_inst).order_by('-timestamp')
- if last_time:
- lt = last_time[0].timestamp.ctime()
- else:
- lt = False
try:
pingability[name]
except KeyError:
pingability[name] = 'N'
for statistics in node.findall('Statistics'):
t = strptime(statistics.get('time'))
- if lt:
- st = mktime(t)
- if st < lt:
- if verbose:
- print "Skipping Client %s time %s;already in db" \
- % (name, strftime("%c", t))
- continue
timestamp = datetime(t[0],t[1],t[2],t[3],t[4],t[5])#Maybe replace with django.core.db typecasts typecast_timestamp()? import from django.backends util
ilist = Interaction.objects.filter(client=c_inst,
timestamp=timestamp)
@@ -164,6 +152,7 @@ if __name__ == '__main__':
if verbose:
print("Interaction for %s at %s with id %s already exists"%(clients[name],
datetime(t[0],t[1],t[2],t[3],t[4],t[5]),current_interaction_id))
+ continue
else:
newint = Interaction(client=c_inst,
timestamp=timestamp,