You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/07/21 20:21:05 UTC

[06/50] [abbrv] incubator-spot git commit: Fixed map view method to read the correct path to the iploc file

Fixed map view method to read the correct path to the iploc file


Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/c8bc7cc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/c8bc7cc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/c8bc7cc4

Branch: refs/heads/master
Commit: c8bc7cc4a2aaf2f5bcfa076353e895b28347461f
Parents: 8830309
Author: LedaLima <le...@apache.org>
Authored: Tue Jul 4 00:24:51 2017 -0500
Committer: LedaLima <le...@apache.org>
Committed: Tue Jul 4 00:24:51 2017 -0500

----------------------------------------------------------------------
 spot-oa/api/resources/flow.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/c8bc7cc4/spot-oa/api/resources/flow.py
----------------------------------------------------------------------
diff --git a/spot-oa/api/resources/flow.py b/spot-oa/api/resources/flow.py
index 6112856..4f4b537 100755
--- a/spot-oa/api/resources/flow.py
+++ b/spot-oa/api/resources/flow.py
@@ -1,10 +1,12 @@
 import api.resources.impala_engine as ImpalaEngine
 import api.resources.hdfs_client as HDFSClient
 import api.resources.configurator as Configuration
-import os
+import os,csv
+import linecache,bisect
 import struct, socket
 from hdfs.util import HdfsError
 import json
+import numpy as np
 
 """
 --------------------------------------------------------------------------
@@ -370,7 +372,7 @@ def create_storyboard(expanded_search,date,ip,title,text,top_results=20):
 
 
     cpath = "{0}/context/" \
-    .format(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+    .format(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
 
     iploc = "{0}/{1}".format(cpath,'iploc.csv')
     nwloc = "{0}/{1}".format(cpath,'networkcontext_1.csv')
@@ -541,6 +543,7 @@ Migrated from IPython NoteBooks.
 def create_map_view(ip, inbound, outbound, twoway,date,iploc):
 
     iplist = ''
+    globe_fpath = 'globe-' + ip.replace('.','_') + ".json"
     if os.path.isfile(iploc):
         iplist = np.loadtxt(iploc,dtype=np.uint32,delimiter=',',usecols={0},\
         converters={0: lambda s: np.uint32(s.replace('"',''))})
@@ -549,7 +552,7 @@ def create_map_view(ip, inbound, outbound, twoway,date,iploc):
 
     response = ""
     if iplist != '':
-        globe_fpath = 'globe-' + ip.replace('.','_') + ".json"
+        
         globe_json = {}
         globe_json['type'] = "FeatureCollection"
         globe_json['sourceips'] = []
@@ -636,7 +639,7 @@ def create_map_view(ip, inbound, outbound, twoway,date,iploc):
         hdfs_path = "{0}/flow/oa/storyboard/{1}/{2}/{3}/{4}" \
         .format(app_path,date.year,date.month,date.day,ip.replace(".","_"))
 
-        if HDFSClient.put_file_json(globe_json,hdfs_path,stats_fpath,overwrite_file=True) :
+        if HDFSClient.put_file_json(globe_json,hdfs_path,globe_fpath,overwrite_file=True) :
             response = "Geolocation map successfully created \n"
         else:
             response = "The map can't be created without an iploc file \n"