Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -126,33 +126,33 @@ def mainFunc(STREAM_ID, SOURCE_BRANCH, TARGET_BRANCH, UUID_COL, ATTR_METADATA, K
|
|
126 |
|
127 |
streamData_new.append(datanew)
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
|
157 |
|
158 |
@webhook_endpoint
|
|
|
126 |
|
127 |
streamData_new.append(datanew)
|
128 |
|
129 |
+
log["avg_attrRemoved"] = log["avg_attrRemoved"]/len(stream_data)
|
130 |
+
log["removedAttr"] = list(set(log["removedAttr"]))
|
131 |
+
|
132 |
+
stream_new = copy.deepcopy(stream)
|
133 |
+
|
134 |
+
stream_new["@Data"]["@{0}"] = streamData_new
|
135 |
+
#add additional data to stream
|
136 |
+
stream_new["logs"] = json.dumps(log)
|
137 |
+
stream_new["attributeMetaData"] = json.dumps(attributeMetaData)
|
138 |
+
stream_new["availableAttributes"] = json.dumps(availableAttributes)
|
139 |
+
|
140 |
+
|
141 |
+
# set stream and branch
|
142 |
+
# Get transport
|
143 |
+
transport = ServerTransport(client=CLIENT, stream_id=STREAM_ID)
|
144 |
+
# Send the data object to the speckle stream
|
145 |
+
object_id = operations.send(stream_new, [transport])
|
146 |
+
time.sleep(5)
|
147 |
+
# Create a new commit with the new object
|
148 |
+
commit_id = CLIENT.commit.create(
|
149 |
+
STREAM_ID,
|
150 |
+
object_id= object_id,
|
151 |
+
message="auto commit, removed datapoints: " + str( log["removedDatapoints"]) + "avg. removed attributes: "+ str(log["avg_attrRemoved"]),
|
152 |
+
branch_name=TARGET_BRANCH,
|
153 |
+
)
|
154 |
+
|
155 |
+
print(commit_id)
|
156 |
|
157 |
|
158 |
@webhook_endpoint
|