Spaces:
Sleeping
Sleeping
lukestanley
commited on
Commit
•
960dc11
1
Parent(s):
2c65c23
Add local logging option if SKIP_NETWORK environment variable is set
Browse files
data.py
CHANGED
@@ -34,3 +34,12 @@ def log_to_jsonl(file_path, data):
|
|
34 |
# Create a new thread and start it
|
35 |
thread = threading.Thread(target=_log_to_jsonl)
|
36 |
thread.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# Create a new thread and start it
|
35 |
thread = threading.Thread(target=_log_to_jsonl)
|
36 |
thread.start()
|
37 |
+
|
38 |
+
# If there is an ENV var called SKIP_NETWORK, we just locally save the data
|
39 |
+
|
40 |
+
def local_log_to_jsonl(file_path, data):
|
41 |
+
with open("local_data.jsonl", "a") as f:
|
42 |
+
f.write(json.dumps({"file_path": file_path, "data": data}) + "\n")
|
43 |
+
|
44 |
+
if os.environ.get("SKIP_NETWORK") is not None:
|
45 |
+
log_to_jsonl = local_log_to_jsonl
|