Skip to content

Commit 356a06a

Browse files
committed
more instnaces
1 parent 9467984 commit 356a06a

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

app.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
runtime: python39
22
service: iris3
33
automatic_scaling:
4-
max_instances: 3
5-
max_concurrent_requests: 3
4+
max_instances: 6
5+
max_concurrent_requests: 5
66
instance_class: F2
77
inbound_services:
88
- warmup

cron.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
cron:
33
- description: "Invoke /schedule which sends out messages triggering do_label per project/plugin."
44
url: /schedule
5-
schedule: every day 13:27
5+
schedule: every day 10:00
66
target: iris3

main.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
app.wsgi_app = google.appengine.api.wrap_wsgi_app(app.wsgi_app)
2121

22-
from util.utils import init_logging
22+
from util.utils import init_logging, sort_dict
2323

2424
# Must init logging before any library code writes logs (which would then just override our config)
2525
init_logging()
@@ -66,10 +66,7 @@
6666

6767
gcp_utils.set_env()
6868

69-
logging.info(
70-
"env GAE_USE_SOCKETS_HTTPLIB is %s", os.environ.get("GAE_USE_SOCKETS_HTTPLIB")
71-
)
72-
logging.info("env PYTHONMALLOC is %s", os.environ.get("PYTHONMALLOC"))
69+
logging.info("env is %s", sort_dict( (os.environ.copy())))
7370

7471
PluginHolder.init()
7572

@@ -254,10 +251,10 @@ def __label_one_0(data, plugin_cls: Type[Plugin]):
254251
plugin = PluginHolder.get_plugin_instance(plugin_cls)
255252
gcp_object = plugin.get_gcp_object(data)
256253
if gcp_object is not None:
257-
project_id = data["resource"]["labels"]["project_id"]
254+
project_id = data["labels"]["project_id"]
258255
if is_project_enabled(project_id):
259256
logging.info(
260-
"Will label_one() in %s, existing object %s...",
257+
"Will label_one() in %s, existing object %s ",
261258
project_id,
262259
str(gcp_object)[:100],
263260
)

plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def load_plugin_class(name) -> Type:
237237
] = None # Initialize with NO instance to avoid importing
238238
loaded.append(plugin_class.__name__)
239239

240-
logging.info("Loaded plugins: %s", loaded)
240+
241241
assert cls.plugins, "No plugins defined"
242242

243243
@classmethod

util/gcp_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from util import localdev_config, utils
1414
from util.detect_gae import detect_gae
15-
from util.utils import timed_lru_cache, log_time, dict_to_camelcase
15+
from util.utils import timed_lru_cache, log_time, dict_to_camelcase, sort_dict
1616

1717
__invocation_count = Counter()
1818

@@ -26,9 +26,7 @@ def increment_invocation_count(path: str):
2626

2727
def count_invocations_by_path():
2828
d = dict(__invocation_count)
29-
keys = sorted(list(d.keys()))
30-
sorted_dict = {i: d[i] for i in keys}
31-
return sorted_dict
29+
return sort_dict(d)
3230

3331

3432
def current_project_id():

util/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ def run_command(command_s):
256256

257257
def mkdirs(dir_):
258258
pathlib.Path(dir_).mkdir(parents=True, exist_ok=True)
259+
260+
261+
def sort_dict(d):
262+
keys = sorted(list(d.keys()))
263+
sorted_dict = {i: d[i] for i in keys}
264+
return sorted_dict

0 commit comments

Comments
 (0)