Commit 3ca1ebf2 by John Donnal

fixed refresh bug for modifications where an item is deleted and replaced by one with the same name

parent 66fc4c14
...@@ -68,6 +68,14 @@ module Joule ...@@ -68,6 +68,14 @@ module Joule
attrs[:joule_id] = schema[:id] attrs[:joule_id] = schema[:id]
attrs[:hidden] = false attrs[:hidden] = false
db_folder.update(attrs) db_folder.update(attrs)
unless db_folder.valid?
if db_folder.errors.messages.keys.include?(:name) \
and db_folder.errors.messages[:name][0].include?("already used")
db_folder.parent.subfolders.where(name: db_folder.name).update(name: "#{db_folder.name}__#{rand}")
# try to save again
db_folder.update!(attrs)
end
end
#puts db_folder.parent.id #puts db_folder.parent.id
# update or create subfolders # update or create subfolders
updated_ids = [] updated_ids = []
...@@ -195,7 +203,17 @@ module Joule ...@@ -195,7 +203,17 @@ module Joule
attrs[:total_time] = schema[:data_info][:total_time] attrs[:total_time] = schema[:data_info][:total_time]
attrs[:size_on_disk] = schema[:data_info][:bytes] attrs[:size_on_disk] = schema[:data_info][:bytes]
end end
db_stream.update!(attrs) db_stream.update(attrs)
# check if model has a unique name, if not rename the conflicting
# stream which should be flagged for deletion later
unless db_stream.valid?
if db_stream.errors.messages.keys.include?(:name) \
and db_stream.errors.messages[:name][0].include?("already used")
db_stream.db_folder.db_streams.where(name: db_stream.name).update(name: "#{db_stream.name}__#{rand}")
# try to save again
db_stream.update!(attrs)
end
end
#db_stream.db_elements.destroy_all #db_stream.db_elements.destroy_all
schema[:elements].each do |element_config| schema[:elements].each do |element_config|
element = db_stream.db_elements.find_by_column(element_config[:index]) element = db_stream.db_elements.find_by_column(element_config[:index])
...@@ -221,6 +239,16 @@ module Joule ...@@ -221,6 +239,16 @@ module Joule
end end
attrs[:event_fields_json] = schema[:event_fields].to_json attrs[:event_fields_json] = schema[:event_fields].to_json
event_stream.update(attrs) event_stream.update(attrs)
# check if model has a unique name, if not rename the conflicting
# stream which should be flagged for deletion later
unless event_stream.valid?
if event_stream.errors.messages.keys.include?(:name) \
and event_stream.errors.messages[:name][0].include?("already used")
event_stream.db_folder.event_streams.where(name: event_stream.name).update(name: "#{event_stream.name}__#{rand}")
# try to save again
event_stream.update!(attrs)
end
end
end end
......
{ {
"id": 1, "id": 2,
"name": "root", "name": "root",
"description": null, "description": null,
"locked": true, "locked": true,
"updated_at": "2023-07-01T01:00:46.825436", "updated_at": "2023-08-17T15:56:01.868048",
"children": [ "children": [
{ {
"id": 214, "id": 52,
"name": "folder_1", "name": "folder_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.712913", "updated_at": "2023-08-17T15:56:01.640929",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 210, "id": 52,
"name": "stream_1_1", "name": "stream_1_1",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.648129", "updated_at": "2023-08-17T15:56:01.605319",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 569, "id": 129,
"index": 0, "index": 0,
"name": "x", "name": "x",
"units": "", "units": "",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 570, "id": 130,
"index": 1, "index": 1,
"name": "y", "name": "y",
"units": "", "units": "",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"default_min": -6.0 "default_min": -6.0
}, },
{ {
"id": 571, "id": 131,
"index": 2, "index": 2,
"name": "z", "name": "z",
"units": "watts", "units": "watts",
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
] ]
}, },
{ {
"id": 211, "id": 53,
"name": "stream_1_2", "name": "stream_1_2",
"description": "", "description": "",
"datatype": "uint8", "datatype": "uint8",
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.712913", "updated_at": "2023-08-17T15:56:01.640929",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 572, "id": 132,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 573, "id": 133,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 574, "id": 134,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -123,22 +123,22 @@ ...@@ -123,22 +123,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 216, "id": 54,
"name": "folder_3", "name": "folder_3",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.789432", "updated_at": "2023-08-17T15:56:01.737064",
"children": [ "children": [
{ {
"id": 217, "id": 55,
"name": "folder_3_1", "name": "folder_3_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.789432", "updated_at": "2023-08-17T15:56:01.737064",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 214, "id": 56,
"name": "stream_3_1_1", "name": "stream_3_1_1",
"description": "", "description": "",
"datatype": "int32", "datatype": "int32",
...@@ -147,13 +147,13 @@ ...@@ -147,13 +147,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.789432", "updated_at": "2023-08-17T15:56:01.737064",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 580, "id": 140,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 581, "id": 141,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 582, "id": 142,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
], ],
"streams": [ "streams": [
{ {
"id": 213, "id": 55,
"name": "stream_3_1", "name": "stream_3_1",
"description": "", "description": "",
"datatype": "uint16", "datatype": "uint16",
...@@ -205,13 +205,13 @@ ...@@ -205,13 +205,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.781562", "updated_at": "2023-08-17T15:56:01.702891",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 577, "id": 137,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 578, "id": 138,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 579, "id": 139,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -252,15 +252,15 @@ ...@@ -252,15 +252,15 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 215, "id": 53,
"name": "folder_2", "name": "folder_2",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.806925", "updated_at": "2023-08-17T15:56:01.800255",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 212, "id": 54,
"name": "stream_2_1", "name": "stream_2_1",
"description": "", "description": "",
"datatype": "int16", "datatype": "int16",
...@@ -269,13 +269,13 @@ ...@@ -269,13 +269,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.770594", "updated_at": "2023-08-17T15:56:01.671074",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 575, "id": 135,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 576, "id": 136,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -303,34 +303,34 @@ ...@@ -303,34 +303,34 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 19, "id": 22,
"name": "transients", "name": "transients",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.797384" "updated_at": "2023-08-17T15:56:01.777163"
}, },
{ {
"id": 20, "id": 23,
"name": "loads", "name": "loads",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.806925" "updated_at": "2023-08-17T15:56:01.800255"
} }
] ]
}, },
{ {
"id": 218, "id": 56,
"name": "folder_4", "name": "folder_4",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.825436", "updated_at": "2023-08-17T15:56:01.868048",
"children": [ "children": [
{ {
"id": 219, "id": 57,
"name": "folder_4_1", "name": "folder_4_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.825436", "updated_at": "2023-08-17T15:56:01.868048",
"children": [], "children": [],
"streams": [], "streams": [],
"event_streams": [] "event_streams": []
...@@ -341,5 +341,6 @@ ...@@ -341,5 +341,6 @@
} }
], ],
"streams": [], "streams": [],
"event_streams": [] "event_streams": [],
"active_data_streams": []
} }
\ No newline at end of file
{ {
"id": 1, "id": 2,
"name": "root", "name": "root",
"description": null, "description": null,
"locked": true, "locked": true,
"updated_at": "2023-07-01T01:01:52.380593", "updated_at": "2023-08-17T15:56:02.105895",
"children": [ "children": [
{ {
"id": 218, "id": 56,
"name": "folder_4", "name": "folder_4",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.825436", "updated_at": "2023-08-17T15:56:01.868048",
"children": [ "children": [
{ {
"id": 219, "id": 57,
"name": "folder_4_1", "name": "folder_4_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:00:46.825436", "updated_at": "2023-08-17T15:56:01.868048",
"children": [], "children": [],
"streams": [], "streams": [],
"event_streams": [] "event_streams": []
...@@ -27,22 +27,22 @@ ...@@ -27,22 +27,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 216, "id": 54,
"name": "folder_3", "name": "folder_3",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"children": [ "children": [
{ {
"id": 217, "id": 55,
"name": "folder_3_1", "name": "folder_3_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 214, "id": 56,
"name": "stream_3_1_1", "name": "stream_3_1_1",
"description": "", "description": "",
"datatype": "int32", "datatype": "int32",
...@@ -51,13 +51,13 @@ ...@@ -51,13 +51,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 580, "id": 140,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "updated_units", "units": "updated_units",
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 581, "id": 141,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 582, "id": 142,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
], ],
"streams": [ "streams": [
{ {
"id": 213, "id": 55,
"name": "stream_3_1", "name": "stream_3_1",
"description": "", "description": "",
"datatype": "uint16", "datatype": "uint16",
...@@ -109,13 +109,13 @@ ...@@ -109,13 +109,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.781562", "updated_at": "2023-08-17T15:56:01.702891",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 577, "id": 137,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 578, "id": 138,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 579, "id": 139,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -156,15 +156,15 @@ ...@@ -156,15 +156,15 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 214, "id": 52,
"name": "folder_1", "name": "folder_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.359634", "updated_at": "2023-08-17T15:56:02.078829",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 210, "id": 52,
"name": "stream_1_1", "name": "stream_1_1",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -173,13 +173,13 @@ ...@@ -173,13 +173,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.648129", "updated_at": "2023-08-17T15:56:01.605319",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 569, "id": 129,
"index": 0, "index": 0,
"name": "x", "name": "x",
"units": "", "units": "",
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 570, "id": 130,
"index": 1, "index": 1,
"name": "y", "name": "y",
"units": "", "units": "",
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
"default_min": -6.0 "default_min": -6.0
}, },
{ {
"id": 571, "id": 131,
"index": 2, "index": 2,
"name": "z", "name": "z",
"units": "watts", "units": "watts",
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
] ]
}, },
{ {
"id": 211, "id": 53,
"name": "stream_1_2", "name": "stream_1_2",
"description": "updated_description", "description": "updated_description",
"datatype": "uint8", "datatype": "uint8",
...@@ -226,13 +226,13 @@ ...@@ -226,13 +226,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:01:52.359634", "updated_at": "2023-08-17T15:56:02.078829",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 572, "id": 132,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 573, "id": 133,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 574, "id": 134,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -273,15 +273,15 @@ ...@@ -273,15 +273,15 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 215, "id": 53,
"name": "folder_2", "name": "folder_2",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.380593", "updated_at": "2023-08-17T15:56:02.105895",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 212, "id": 54,
"name": "stream_2_1", "name": "stream_2_1",
"description": "", "description": "",
"datatype": "int16", "datatype": "int16",
...@@ -290,13 +290,13 @@ ...@@ -290,13 +290,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.770594", "updated_at": "2023-08-17T15:56:01.671074",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 575, "id": 135,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 576, "id": 136,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -324,24 +324,25 @@ ...@@ -324,24 +324,25 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 20, "id": 23,
"name": "loads", "name": "loads",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.806925" "updated_at": "2023-08-17T15:56:01.800255"
}, },
{ {
"id": 19, "id": 22,
"name": "transients", "name": "transients",
"description": "", "description": "",
"event_fields": { "event_fields": {
"updated": "string" "updated": "string"
}, },
"updated_at": "2023-07-01T01:01:52.380593" "updated_at": "2023-08-17T15:56:02.105895"
} }
] ]
} }
], ],
"streams": [], "streams": [],
"event_streams": [] "event_streams": [],
"active_data_streams": []
} }
\ No newline at end of file
{ {
"id": 1, "id": 2,
"name": "root", "name": "root",
"description": null, "description": null,
"locked": true, "locked": true,
"updated_at": "2023-07-01T01:04:06.231237", "updated_at": "2023-08-17T15:56:02.344783",
"children": [ "children": [
{ {
"id": 215, "id": 53,
"name": "folder_2", "name": "folder_2",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.380593", "updated_at": "2023-08-17T15:56:02.105895",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 212, "id": 54,
"name": "stream_2_1", "name": "stream_2_1",
"description": "", "description": "",
"datatype": "int16", "datatype": "int16",
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.770594", "updated_at": "2023-08-17T15:56:01.671074",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 575, "id": 135,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 576, "id": 136,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -57,33 +57,33 @@ ...@@ -57,33 +57,33 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 20, "id": 23,
"name": "loads", "name": "loads",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.806925" "updated_at": "2023-08-17T15:56:01.800255"
}, },
{ {
"id": 19, "id": 22,
"name": "transients", "name": "transients",
"description": "", "description": "",
"event_fields": { "event_fields": {
"updated": "string" "updated": "string"
}, },
"updated_at": "2023-07-01T01:01:52.380593" "updated_at": "2023-08-17T15:56:02.105895"
} }
] ]
}, },
{ {
"id": 214, "id": 52,
"name": "folder_1", "name": "folder_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 210, "id": 52,
"name": "stream_1_1", "name": "stream_1_1",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -92,13 +92,13 @@ ...@@ -92,13 +92,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.648129", "updated_at": "2023-08-17T15:56:01.605319",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 569, "id": 129,
"index": 0, "index": 0,
"name": "x", "name": "x",
"units": "", "units": "",
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 570, "id": 130,
"index": 1, "index": 1,
"name": "y", "name": "y",
"units": "", "units": "",
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
"default_min": -6.0 "default_min": -6.0
}, },
{ {
"id": 571, "id": 131,
"index": 2, "index": 2,
"name": "z", "name": "z",
"units": "watts", "units": "watts",
...@@ -139,22 +139,22 @@ ...@@ -139,22 +139,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 218, "id": 56,
"name": "folder_4", "name": "folder_4",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.231237", "updated_at": "2023-08-17T15:56:02.344783",
"children": [ "children": [
{ {
"id": 219, "id": 57,
"name": "folder_4_1", "name": "folder_4_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.201973", "updated_at": "2023-08-17T15:56:02.298283",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 211, "id": 53,
"name": "stream_1_2", "name": "stream_1_2",
"description": "updated_description", "description": "updated_description",
"datatype": "uint8", "datatype": "uint8",
...@@ -163,13 +163,13 @@ ...@@ -163,13 +163,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 572, "id": 132,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 573, "id": 133,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 574, "id": 134,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -210,22 +210,22 @@ ...@@ -210,22 +210,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 216, "id": 54,
"name": "folder_3", "name": "folder_3",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.231225", "updated_at": "2023-08-17T15:56:02.344742",
"children": [ "children": [
{ {
"id": 217, "id": 55,
"name": "folder_3_1", "name": "folder_3_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 214, "id": 56,
"name": "stream_3_1_1", "name": "stream_3_1_1",
"description": "", "description": "",
"datatype": "int32", "datatype": "int32",
...@@ -234,13 +234,13 @@ ...@@ -234,13 +234,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 580, "id": 140,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "updated_units", "units": "updated_units",
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 581, "id": 141,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 582, "id": 142,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
], ],
"streams": [ "streams": [
{ {
"id": 213, "id": 55,
"name": "stream_3_1", "name": "stream_3_1",
"description": "", "description": "",
"datatype": "uint16", "datatype": "uint16",
...@@ -292,13 +292,13 @@ ...@@ -292,13 +292,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.781562", "updated_at": "2023-08-17T15:56:01.702891",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 577, "id": 137,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 578, "id": 138,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 579, "id": 139,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -344,5 +344,6 @@ ...@@ -344,5 +344,6 @@
} }
], ],
"streams": [], "streams": [],
"event_streams": [] "event_streams": [],
"active_data_streams": []
} }
\ No newline at end of file
{ {
"id": 1, "id": 2,
"name": "root", "name": "root",
"description": null, "description": null,
"locked": true, "locked": true,
"updated_at": "2023-07-01T01:04:37.485771", "updated_at": "2023-08-17T15:56:02.616925",
"children": [ "children": [
{ {
"id": 214, "id": 52,
"name": "folder_1", "name": "folder_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 210, "id": 52,
"name": "stream_1_1", "name": "stream_1_1",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.648129", "updated_at": "2023-08-17T15:56:01.605319",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 569, "id": 129,
"index": 0, "index": 0,
"name": "x", "name": "x",
"units": "", "units": "",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 570, "id": 130,
"index": 1, "index": 1,
"name": "y", "name": "y",
"units": "", "units": "",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"default_min": -6.0 "default_min": -6.0
}, },
{ {
"id": 571, "id": 131,
"index": 2, "index": 2,
"name": "z", "name": "z",
"units": "watts", "units": "watts",
...@@ -70,22 +70,22 @@ ...@@ -70,22 +70,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 218, "id": 56,
"name": "folder_4", "name": "folder_4",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.485771", "updated_at": "2023-08-17T15:56:02.616925",
"children": [ "children": [
{ {
"id": 219, "id": 57,
"name": "folder_4_1", "name": "folder_4_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.435366", "updated_at": "2023-08-17T15:56:02.526587",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 211, "id": 53,
"name": "stream_1_2", "name": "stream_1_2",
"description": "updated_description", "description": "updated_description",
"datatype": "uint8", "datatype": "uint8",
...@@ -94,13 +94,13 @@ ...@@ -94,13 +94,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 572, "id": 132,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 573, "id": 133,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 574, "id": 134,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -140,31 +140,31 @@ ...@@ -140,31 +140,31 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 20, "id": 23,
"name": "loads", "name": "loads",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.806925" "updated_at": "2023-08-17T15:56:01.800255"
} }
] ]
}, },
{ {
"id": 216, "id": 54,
"name": "folder_3", "name": "folder_3",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.485771", "updated_at": "2023-08-17T15:56:02.616925",
"children": [ "children": [
{ {
"id": 217, "id": 55,
"name": "folder_3_1", "name": "folder_3_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 214, "id": 56,
"name": "stream_3_1_1", "name": "stream_3_1_1",
"description": "", "description": "",
"datatype": "int32", "datatype": "int32",
...@@ -173,13 +173,13 @@ ...@@ -173,13 +173,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 580, "id": 140,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "updated_units", "units": "updated_units",
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 581, "id": 141,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 582, "id": 142,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -229,5 +229,6 @@ ...@@ -229,5 +229,6 @@
} }
], ],
"streams": [], "streams": [],
"event_streams": [] "event_streams": [],
"active_data_streams": []
} }
\ No newline at end of file
{ {
"id": 1, "id": 2,
"name": "root", "name": "root",
"description": null, "description": null,
"locked": true, "locked": true,
"updated_at": "2023-07-01T01:04:54.865609", "updated_at": "2023-08-17T15:56:02.781566",
"children": [ "children": [
{ {
"id": 214, "id": 52,
"name": "folder_1", "name": "folder_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 210, "id": 52,
"name": "stream_1_1", "name": "stream_1_1",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:00:46.648129", "updated_at": "2023-08-17T15:56:01.605319",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 569, "id": 129,
"index": 0, "index": 0,
"name": "x", "name": "x",
"units": "", "units": "",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 570, "id": 130,
"index": 1, "index": 1,
"name": "y", "name": "y",
"units": "", "units": "",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"default_min": -6.0 "default_min": -6.0
}, },
{ {
"id": 571, "id": 131,
"index": 2, "index": 2,
"name": "z", "name": "z",
"units": "watts", "units": "watts",
...@@ -70,22 +70,22 @@ ...@@ -70,22 +70,22 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 218, "id": 56,
"name": "folder_4", "name": "folder_4",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.485771", "updated_at": "2023-08-17T15:56:02.616925",
"children": [ "children": [
{ {
"id": 219, "id": 57,
"name": "folder_4_1", "name": "folder_4_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.435366", "updated_at": "2023-08-17T15:56:02.526587",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 211, "id": 53,
"name": "stream_1_2", "name": "stream_1_2",
"description": "updated_description", "description": "updated_description",
"datatype": "uint8", "datatype": "uint8",
...@@ -94,13 +94,13 @@ ...@@ -94,13 +94,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:04:06.201445", "updated_at": "2023-08-17T15:56:02.295146",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 572, "id": 132,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 573, "id": 133,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 574, "id": 134,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -140,31 +140,31 @@ ...@@ -140,31 +140,31 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 20, "id": 23,
"name": "loads", "name": "loads",
"description": "", "description": "",
"event_fields": {}, "event_fields": {},
"updated_at": "2023-07-01T01:00:46.806925" "updated_at": "2023-08-17T15:56:01.800255"
} }
] ]
}, },
{ {
"id": 216, "id": 54,
"name": "folder_3", "name": "folder_3",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:37.485771", "updated_at": "2023-08-17T15:56:02.616925",
"children": [ "children": [
{ {
"id": 217, "id": 55,
"name": "folder_3_1", "name": "folder_3_1",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 214, "id": 56,
"name": "stream_3_1_1", "name": "stream_3_1_1",
"description": "", "description": "",
"datatype": "int32", "datatype": "int32",
...@@ -173,13 +173,13 @@ ...@@ -173,13 +173,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:01:52.331388", "updated_at": "2023-08-17T15:56:02.040790",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 580, "id": 140,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "updated_units", "units": "updated_units",
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 581, "id": 141,
"index": 1, "index": 1,
"name": "1", "name": "1",
"units": "", "units": "",
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
"default_min": null "default_min": null
}, },
{ {
"id": 582, "id": 142,
"index": 2, "index": 2,
"name": "2", "name": "2",
"units": "", "units": "",
...@@ -228,15 +228,15 @@ ...@@ -228,15 +228,15 @@
"event_streams": [] "event_streams": []
}, },
{ {
"id": 220, "id": 58,
"name": "new", "name": "new",
"description": null, "description": null,
"locked": false, "locked": false,
"updated_at": "2023-07-01T01:04:54.865609", "updated_at": "2023-08-17T15:56:02.781566",
"children": [], "children": [],
"streams": [ "streams": [
{ {
"id": 216, "id": 58,
"name": "new_data_stream", "name": "new_data_stream",
"description": "", "description": "",
"datatype": "float32", "datatype": "float32",
...@@ -245,13 +245,13 @@ ...@@ -245,13 +245,13 @@
"is_configured": false, "is_configured": false,
"is_source": false, "is_source": false,
"is_destination": false, "is_destination": false,
"updated_at": "2023-07-01T01:04:54.865609", "updated_at": "2023-08-17T15:56:02.781566",
"locked": false, "locked": false,
"active": false, "active": false,
"decimate": true, "decimate": true,
"elements": [ "elements": [
{ {
"id": 586, "id": 146,
"index": 0, "index": 0,
"name": "0", "name": "0",
"units": "", "units": "",
...@@ -267,17 +267,18 @@ ...@@ -267,17 +267,18 @@
], ],
"event_streams": [ "event_streams": [
{ {
"id": 21, "id": 24,
"name": "new_event_stream", "name": "new_event_stream",
"description": "", "description": "",
"event_fields": { "event_fields": {
"test": "string" "test": "string"
}, },
"updated_at": "2023-07-01T01:04:54.851513" "updated_at": "2023-08-17T15:56:02.757111"
} }
] ]
} }
], ],
"streams": [], "streams": [],
"event_streams": [] "event_streams": [],
"active_data_streams": []
} }
\ No newline at end of file
...@@ -2,10 +2,18 @@ ...@@ -2,10 +2,18 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"id": "be19494a-9aa1-47e1-943c-50a6a13fcb2f", "id": "be19494a-9aa1-47e1-943c-50a6a13fcb2f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k\n"
]
}
],
"source": [ "source": [
"import joule\n", "import joule\n",
"import requests\n", "import requests\n",
...@@ -14,10 +22,18 @@ ...@@ -14,10 +22,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"id": "8ab34a29-f046-45d2-b45b-d08ffef4147b", "id": "8ab34a29-f046-45d2-b45b-d08ffef4147b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 top level folders\n"
]
}
],
"source": [ "source": [
"node = joule.api.get_node()\n", "node = joule.api.get_node()\n",
"root = await node.folder_get('/')\n", "root = await node.folder_get('/')\n",
...@@ -33,7 +49,7 @@ ...@@ -33,7 +49,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 3,
"id": "b45e0f20-4544-4368-8e72-5b51c82254bd", "id": "b45e0f20-4544-4368-8e72-5b51c82254bd",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -75,10 +91,19 @@ ...@@ -75,10 +91,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 4,
"id": "d5c820d5-6e93-4bea-9d9c-da166e68c69b", "id": "d5c820d5-6e93-4bea-9d9c-da166e68c69b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [ "source": [
"\n", "\n",
"stream_1_1 = joule.api.DataStream(\"stream_1_1\",elements=[joule.api.Element(x) for x in \"xyz\"])\n", "stream_1_1 = joule.api.DataStream(\"stream_1_1\",elements=[joule.api.Element(x) for x in \"xyz\"])\n",
...@@ -137,10 +162,19 @@ ...@@ -137,10 +162,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"id": "ac75335d-cd3d-46a5-8aa5-0fd4555efc79", "id": "ac75335d-cd3d-46a5-8aa5-0fd4555efc79",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [ "source": [
"stream_3_1_1.elements[0].units=\"updated_units\"\n", "stream_3_1_1.elements[0].units=\"updated_units\"\n",
"stream_1_2.description = \"updated_description\"\n", "stream_1_2.description = \"updated_description\"\n",
...@@ -180,10 +214,19 @@ ...@@ -180,10 +214,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"id": "3c127916-ae78-461a-bf3d-f0af66829e14", "id": "3c127916-ae78-461a-bf3d-f0af66829e14",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [ "source": [
"await node.data_stream_move(stream_1_2, \"/folder_4/folder_4_1\")\n", "await node.data_stream_move(stream_1_2, \"/folder_4/folder_4_1\")\n",
"await node.folder_move(\"/folder_3\",\"/folder_4\")\n", "await node.folder_move(\"/folder_3\",\"/folder_4\")\n",
...@@ -215,10 +258,19 @@ ...@@ -215,10 +258,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"id": "8e486e6a-9521-4890-b71e-41f4bcf2fcd2", "id": "8e486e6a-9521-4890-b71e-41f4bcf2fcd2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [ "source": [
"await node.event_stream_move(load_events,\"/folder_4/folder_4_1\")\n", "await node.event_stream_move(load_events,\"/folder_4/folder_4_1\")\n",
"await node.folder_delete(\"/folder_2\")\n", "await node.folder_delete(\"/folder_2\")\n",
...@@ -252,27 +304,93 @@ ...@@ -252,27 +304,93 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"id": "27d91f25-929f-46cf-81da-7f28cd5e4f7d", "id": "27d91f25-929f-46cf-81da-7f28cd5e4f7d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [ "source": [
"new_data_stream = joule.api.DataStream(\"new_data_stream\",elements=[joule.api.Element(f\"{i}\") for i in range(1)])\n", "new_data_stream = joule.api.DataStream(\"new_data_stream\",elements=[joule.api.Element(f\"{i}\") for i in range(1)])\n",
"new_event_stream = joule.api.EventStream(\"new_event_stream\",event_fields={\"test\":\"string\"})\n", "new_event_stream = joule.api.EventStream(\"new_event_stream\",event_fields={\"test\":\"string\"})\n",
"\n", "\n",
"load_events = await node.event_stream_create(new_event_stream, \"/new\")\n", "load_events = await node.event_stream_create(new_event_stream, \"/new\")\n",
"new_data_stream = await node.data_stream_create(new_data_stream, \"/new\")\n", "new_data_stream = await node.data_stream_create(new_data_stream, \"/new\")\n",
"await save_schema(\"4_added_schema.json\")\n", "await save_schema(\"4_added_schema.json\")"
"await node.close()" ]
},
{
"cell_type": "markdown",
"id": "3bc7e40e",
"metadata": {},
"source": [
"*Replace folders and streams with new ones that have the same name*\n",
"\n",
"<pre>\n",
"root\n",
"├── new\n",
"│ └── new_data_stream:float32_1\n",
"│ └── new_event_stream <== new with same name\n",
"├── folder_1\n",
"│ └── stream_1_1: float32_3 <== new with same name\n",
"│ └── folder_3 <== moved \n",
"│ │ └── folder_3_1\n",
"│ │ └── stream_3_1_1: int32_3\n",
"│ └── folder_4 <== moved\n",
"│ └── folder_4_1\n",
"│ └── stream_2_1: uint8_3\n",
"│ └── loads (event stream)\n",
"└── folder_4 <== new with same name\n",
" └── stream_4: uint16\n",
" └── events_4 (event stream)\n",
" └── new_event_stream <== old version but moved\n",
" </pre>"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 9,
"id": "bb86311e-f014-4c28-b48a-aac4dabd1fec", "id": "b610e420",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
"source": [] {
"name": "stderr",
"output_type": "stream",
"text": [
"/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py:1095: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"source": [
"# remove old versions\n",
"await node.folder_move(\"/folder_4/folder_3\",\"/folder_1\")\n",
"await node.folder_move(\"/folder_4\", \"/folder_1\")\n",
"await node.data_stream_delete(\"/folder_1/stream_1_1\")\n",
"await node.event_stream_move(\"/new/new_event_stream\",\"/folder_4\")\n",
"\n",
"# create new versions\n",
"new_event_stream = joule.api.EventStream(\"new_event_stream\",event_fields={\"test\":\"string\"})\n",
"await node.event_stream_create(new_event_stream, \"/new\")\n",
"\n",
"stream_1_1 = joule.api.DataStream(\"stream_1_1\",elements=[joule.api.Element(x) for x in \"xyz\"])\n",
"await node.data_stream_create(stream_1_1,\"/folder_1\")\n",
"\n",
"stream_4_1_1 = joule.api.DataStream(\"stream_4\",datatype=\"uint16\",elements=[joule.api.Element(f\"{i}\") for i in range(3)])\n",
"await node.data_stream_create(stream_4_1_1,\"/folder_4\")\n",
"\n",
"events_4 = joule.api.EventStream(\"events_4\",event_fields={\"test\":\"string\"})\n",
"await node.event_stream_create(events_4, \"/folder_4\")\n",
"await save_schema(\"5_modified_schema.json\")\n",
"await node.close()"
]
} }
], ],
"metadata": { "metadata": {
...@@ -291,7 +409,7 @@ ...@@ -291,7 +409,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.9" "version": "3.11.0rc1"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -160,6 +160,33 @@ describe Joule::UpdateDb do ...@@ -160,6 +160,33 @@ describe Joule::UpdateDb do
new_folder = DbFolder.find_by_name("new") new_folder = DbFolder.find_by_name("new")
expect(new_folder.db_streams.count).to eq 1 expect(new_folder.db_streams.count).to eq 1
expect(new_folder.event_streams.count).to eq 1 expect(new_folder.event_streams.count).to eq 1
new_event_stream_id = EventStream.find_by_name("new_event_stream").id
folder_4_id = DbFolder.find_by_name("folder_4").id
folder_3_id = DbFolder.find_by_name("folder_3").id
#################################
### Now update the schema (5) ###
#################################
puts "##### remove and add new with same name #######"
service.run({}, load_schema('5_modified_schema'))
# aggregate checks
expect(@db.root_folder.subfolders.count).to eq 3
expect(DbFolder.count).to eq 8
expect(EventStream.count).to eq 4
expect(DbElement.count).to eq 13
expect(DbStream.count).to eq 5
# expect things that moved to have the same id...
expect(DbFolder.find_by_name("folder_4").id).to eq folder_4_id
expect(DbFolder.find_by_name("folder_3").id).to eq folder_3_id
# ...but be in a new location...
expect(DbFolder.find(folder_4_id).parent.name).to eq "folder_1"
expect(DbFolder.find(folder_3_id).parent.name).to eq "folder_1"
expect(EventStream.find(new_event_stream_id).db_folder.name).to eq "folder_4"
# ...and have the same attributes as before
expect(EventStream.find(new_event_stream_id).name).to eq "new_event_stream"
# expect new items to be added
expect(DbFolder.where(name:"new").first.event_streams.first.name).to eq "new_event_stream"
expect(DbFolder.where(name:"folder_1").first.db_streams.first.name).to eq "stream_1_1"
expect(@db.root_folder.subfolders.where(name: "folder_4").first).not_to be_nil
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment