Skip to content

Commit 390a5fd

Browse files
committed
debug logging
1 parent 1cd5ae4 commit 390a5fd

File tree

7 files changed

+27
-3
lines changed

7 files changed

+27
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
#
3+
.venv/**
34
./idea
45
.idea/
56
__pycache__/
@@ -109,3 +110,6 @@ venv.bak/
109110
/config.json
110111
config.json
111112
/dev_config.json
113+
**.bak
114+
# Datastore not used, but this is autogenerated
115+
index.yaml

appengine_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from google.appengine.ext import vendor
22
import sys
3+
import os
34
# Add any libraries installed in the "lib" folder.
5+
print("will add lib")
46
vendor.add('lib')
7+
print('added lib')
8+
vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))
9+
print('added abs path to lib')
510
sys.path = ['lib'] + sys.path

deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ if [[ $# -eq 0 ]] ; then
1010
echo Missing project id argument
1111
exit
1212
fi
13-
14-
PROJECTID=$(gcloud projects list | grep -iw "$1" | awk '{print $1}')
13+
echo xxxx $1 xxxx
14+
PROJECTID=$(gcloud projects list | grep -i "^$1 " | awk '{print $1}')
1515

1616
if [ -z "$PROJECTID" ]; then
1717
echo "Project $1 Not Found!"
1818
exit 1
1919
fi
20+
echo "PROJECTID $PROJECTID XXX"
2021

2122
#set the project context
2223
echo "Project ID $PROJECTID"

main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
app = Flask(__name__)
1616
plugins = []
1717

18-
1918
def store(key, value, chunksize=950000):
2019
serialized = cloudpickle.dumps(value, 2)
2120
values = {}
2221
for i in xrange(0, len(serialized), chunksize):
22+
if chunksize>10**6:
23+
print('setting memcache', key,'with chunk of size', chunksize, serialized[i:i + 100] )
2324
values['%s.%s' % (key, i // chunksize)] = serialized[i:i + chunksize]
2425
return memcache.set_multi(values)
2526

@@ -121,9 +122,12 @@ def schedule():
121122

122123
@app.route('/tasks/do_tag', methods=['GET'])
123124
def do_tag():
125+
logging.info("do_tag")
124126
f = retrieve(request.args['plugin'])
127+
logging.info("do_tag",f )
125128
if f is not None:
126129
project_id = request.args['project_id']
130+
logging.info('do_tag', project_id)
127131
f.do_tag(project_id)
128132
return 'ok', 200
129133

plugins/bigquery.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
""" Taging BQ tabels and datasets."""
22
import logging
3+
import traceback
34

45
from google.auth import app_engine
56
from googleapiclient import discovery, errors
@@ -113,6 +114,7 @@ def get_gcp_object(self, data):
113114
return table
114115
except Exception as e:
115116
logging.error(e)
117+
print(traceback.format_exc())
116118

117119
return None
118120

plugins/gce.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def get_instance(self, project_id, zone, name):
144144

145145

146146
def do_tag(self, project_id):
147+
logging.info("do_tag GCE", project_id)
147148
for zone in self.get_zones(project_id):
148149
instances = self.list_instances(project_id, zone)
149150
for instance in instances:
@@ -169,15 +170,18 @@ def get_gcp_object(self, data):
169170

170171

171172
def tag_one(self, gcp_object, project_id):
173+
logging.info("do_tag GCE", gcp_object)
172174
try:
173175
org_labels = {}
174176
org_labels = gcp_object['labels']
175177
except KeyError:
176178
pass
179+
logging.info('labelFingerprint'+ str(gcp_object.get('labelFingerprint', '')))
177180
labels = dict(
178181
[('labelFingerprint', gcp_object.get('labelFingerprint', ''))])
179182
labels['labels'] = self.gen_labels(gcp_object)
180183
for k, v in org_labels.items():
184+
logging.info('keyvalue'+k+str(v))
181185
labels['labels'][k] = v
182186
try:
183187
zone = gcp_object['zone']

utils/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def fatal_code(e):
6464

6565

6666
def is_service_enbaled(service_list, service):
67+
if service_list is None:
68+
print('service_list is None, service is ', service)
69+
return False
70+
6771
if 'services' in service_list:
6872
for srv in service_list['services']:
6973
if srv['config']['name'].lower() == service.lower():

0 commit comments

Comments
 (0)