Skip to content

Commit

Permalink
Swith to GSON to decode TreeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPeloton committed Dec 6, 2024
1 parent bbdb132 commit 25a3da1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/routes/cutouts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def format_and_send_cutout(payload: dict):
group_alerts=False,
truncated=True,
extract_color=False,
escape_slash=True,
escape_slash=False,
)

json_payload = {}
Expand Down
4 changes: 2 additions & 2 deletions apps/utils/decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ def format_hbase_output(
def hbase_to_dict(hbase_output, escape_slash=False):
"""Optimize hbase output TreeMap for faster conversion to DataFrame"""
gateway = JavaGateway(auto_convert=True)
JSONObject = gateway.jvm.org.json.JSONObject
GSONObject = gateway.jvm.com.google.gson.Gson

# We do bulk export to JSON on Java side to avoid overheads of iterative access
# and then parse it back to Dict in Python
if escape_slash:
hbase_output = str(hbase_output)
optimized = json.loads(JSONObject(hbase_output).toString())
optimized = json.loads(GSONObject().toJson(hbase_output))

return optimized

Expand Down
2 changes: 1 addition & 1 deletion install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ User=almalinux
Group=almalinux
WorkingDirectory=/home/almalinux/fink-object-api/bin

ExecStart=/bin/sh -c 'source /home/almalinux/.bashrc; exec java -cp "Lomikel-03.04.00x-HBase.exe.jar:py4j0.10.9.7.jar" com.Lomikel.Py4J.LomikelGatewayServer 2>&1 >> /tmp/fink_gateway.out'
ExecStart=/bin/sh -c 'source /home/almalinux/.bashrc; exec java -cp "Lomikel-03.04.00x-HBase.exe.jar:py4j0.10.9.7.jar:gson-2.11.0.jar" com.Lomikel.Py4J.LomikelGatewayServer 2>&1 >> /tmp/fink_gateway.out'

[Install]
WantedBy=multi-user.target
Expand Down

0 comments on commit 25a3da1

Please sign in to comment.