Compare commits

..

16 Commits

Author SHA1 Message Date
izzy lyseggen fc7e3ca893 fix(serializer): wrap traverse_base
moving `begin` and `end_write` to the seriazlier due to the new
sqlite transport with batched writes necessitates a wrapper around
`traverse_base` so end/begin write can be called once at the top level.
just adding begin/end write to the original traversal method would make
tons of calls to `end_write` since the traversal is recursive
2022-06-20 11:48:45 +01:00
izzy lyseggen 9a4635c561 fix(client): don't parse obj create response 2022-06-20 11:42:18 +01:00
izzy lyseggen 9f873333f5 fix(serializer): warn but don't throw if ref not found
this is _not_ an issue with the transports, but an issue with using the
graphql api to fetch objects. since you are only receiving one obj and none of
the children, the transport has no way to find them and should simply
return the reference as is. idk why anyone would really use `object.get`
so tbh i'm not surprised no one has found this bug yet lol
2022-06-20 11:21:09 +01:00
izzy lyseggen 50c78d679e style: formatting 2022-06-20 11:17:32 +01:00
izzy lyseggen 72dcb674eb fix(serialization): move end and begin write 2022-06-20 07:52:58 +01:00
izzy lyseggen 9d038de3ab chore: dev container update 2022-06-20 07:52:27 +01:00
Gergő Jedlicska 52a667f28e add start and finish write method calls to base object serialize 2022-06-19 14:41:22 +02:00
Gergő Jedlicska 31cd12160b update test fixture auth to non deprecated token based method 2022-06-19 14:40:50 +02:00
Gergő Jedlicska 22e7f18648 update to new circleci redis baseimage 2022-06-19 14:40:18 +02:00
Gergő Jedlicska 97815ead9d Merge branch 'gergo/sqliteSpeedup' of github.com:specklesystems/specklepy into gergo/sqliteSpeedup 2022-06-19 14:06:18 +02:00
Gergő Jedlicska 332331465d update CI versions 2022-06-19 14:04:38 +02:00
izzy lyseggen b56f006103 ci: formatting 2022-06-17 17:21:06 +01:00
izzy lyseggen 1fdefc8929 ci: bump node version 2022-06-17 16:50:04 +01:00
izzy lyseggen f51dd28e46 chore: upgrade gql3
also removed py-spy as it's not used and i was getting install errors :/
2022-06-17 16:29:28 +01:00
izzy lyseggen e22bfd72ea feat(transports): batching sqlite inserts 2022-06-17 16:15:47 +01:00
Gergő Jedlicska 739d8bc189 quick and hacky sqlite batching 2022-06-17 16:35:15 +02:00
6 changed files with 468 additions and 431 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ workflows:
- test:
matrix:
parameters:
tag: ["3.7", "3.8", "3.9", "3.10"]
tag: ["3.6", "3.7", "3.8", "3.9"]
filters:
tags:
only: /.*/
Generated
+450 -410
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -11,11 +11,11 @@ homepage = "https://speckle.systems/"
[tool.poetry.dependencies]
python = ">=3.7.0, <4.0"
python = "^3.6.5"
pydantic = "^1.8.2"
appdirs = "^1.4.4"
gql = {extras = ["requests", "websockets"], version = "^3.3.0"}
ujson = "^5.3.0"
ujson = "^4.3.0"
Deprecated = "^1.2.13"
[tool.poetry.dev-dependencies]
+10 -14
View File
@@ -1,13 +1,10 @@
import socket
import sys
import queue
import hashlib
import getpass
import logging
import requests
import threading
import platform
import contextlib
"""
Anonymous telemetry to help us understand how to make a better Speckle.
@@ -15,7 +12,7 @@ This really helps us to deliver a better open source project and product!
"""
TRACK = True
HOST_APP = "python"
HOST_APP_VERSION = f"python {'.'.join(map(str, sys.version_info[:2]))}"
HOST_APP_VERSION = f"python {'.'.join(map(str, sys.version_info[:3]))}"
PLATFORMS = {"win32": "Windows", "cygwin": "Windows", "darwin": "Mac OS X"}
LOG = logging.getLogger(__name__)
@@ -78,7 +75,8 @@ def track(action: str, account: "Account" = None, custom_props: dict = None):
METRICS_TRACKER.queue.put_nowait(event_params)
except Exception as ex:
# wrapping this whole thing in a try except as we never want a failure here to annoy users!
LOG.error(f"Error queueing metrics request: {str(ex)}")
LOG.error("Error queueing metrics request: " + str(ex))
def initialise_tracker(account: "Account" = None):
global METRICS_TRACKER
@@ -103,7 +101,8 @@ class Singleton(type):
class MetricsTracker(metaclass=Singleton):
analytics_url = "https://analytics.speckle.systems/track?ip=1"
analytics_token = "acd87c5a50b56df91a795e999812a3a4"
last_user = ""
user_ip = None
last_user = None
last_server = None
platform = None
sending_thread = None
@@ -115,15 +114,12 @@ class MetricsTracker(metaclass=Singleton):
)
self.platform = PLATFORMS.get(sys.platform, "linux")
self.sending_thread.start()
with contextlib.suppress(Exception):
node, user = platform.node(), getpass.getuser()
if node and user:
self.last_user = f"@{self.hash(f'{node}-{user}')}"
self.user_ip = socket.gethostbyname(socket.gethostname())
def set_last_user(self, email: str):
if not email:
return
self.last_user = f"@{self.hash(email)}"
self.last_user = "@" + self.hash(email)
def set_last_server(self, server: str):
if not server:
@@ -141,6 +137,6 @@ class MetricsTracker(metaclass=Singleton):
try:
session.post(self.analytics_url, json=event_params)
except Exception as ex:
LOG.error(f"Error sending metrics request: {str(ex)}")
LOG.error("Error sending metrics request: " + str(ex))
self.queue.task_done()
self.queue.task_done()
+1 -1
View File
@@ -142,7 +142,7 @@ class Base(_RegisteringBase):
id: Optional[str] = None
totalChildrenCount: Optional[int] = None
applicationId: Optional[str] = None
_units: str = None
_units: str = "m"
# dict of chunkable props and their max chunk size
_chunkable: Dict[str, int] = {}
_chunk_size_default: int = 1000
+4 -3
View File
@@ -16,7 +16,6 @@ UNITS_STRINGS = {
}
UNITS_ENCODINGS = {
None: 0,
"none": 0,
"mm": 1,
"cm": 2,
@@ -59,5 +58,7 @@ def get_units_from_encoding(unit: int):
def get_encoding_from_units(unit: str):
try:
return UNITS_ENCODINGS[unit]
except KeyError as e:
raise SpeckleException(message=f"No encoding exists for unit {unit}. Please enter a valid unit to encode (eg {UNITS_ENCODINGS}).") from e
except KeyError:
raise SpeckleException(
message=f"No encoding exists for unit {unit}. Please enter a valid unit to encode (eg {UNITS_ENCODINGS})."
)