neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
force publish support for the pythiae control UI
0aa6955 · gmorell · 2022-08-21 04:58
Files changed
modified
apollos_crib.iml
+7
−0
@@ -1,5 +1,10 @@
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <module type="ELIXIR_MODULE" version="4"> |
| 3 | + <component name="FacetManager"> | |
| 4 | + <facet type="Python" name="Python"> | |
| 5 | + <configuration sdkName="Python 3.8" /> | |
| 6 | + </facet> | |
| 7 | + </component> | |
| 3 | 8 | <component name="NewModuleRootManager"> |
| 4 | 9 | <output url="file://$MODULE_DIR$/_build/dev/lib/apollos_crib/ebin" /> |
| 5 | 10 | <output-test url="file://$MODULE_DIR$/_build/test/lib/apollos_crib/ebin" /> |
@@ -7,6 +12,7 @@
| 7 | 12 | <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" /> |
| 8 | 13 | <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" /> |
| 9 | 14 | <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> |
| 15 | + <sourceFolder url="file://$MODULE_DIR$/clients" isTestSource="false" /> | |
| 10 | 16 | <excludeFolder url="file://$MODULE_DIR$/assets/node_modules/phoenix" /> |
| 11 | 17 | <excludeFolder url="file://$MODULE_DIR$/assets/node_modules/phoenix_html" /> |
| 12 | 18 | <excludeFolder url="file://$MODULE_DIR$/cover" /> |
@@ -92,5 +98,6 @@
| 92 | 98 | <excludeFolder url="file://$MODULE_DIR$/_build/dev/lib/credentials_obfuscation" /> |
| 93 | 99 | </content> |
| 94 | 100 | <orderEntry type="sourceFolder" forTests="false" /> |
| 101 | + <orderEntry type="library" name="Python 3.8 interpreter library" level="application" /> | |
| 95 | 102 | </component> |
| 96 | 103 | </module> |
modified
app.yml
+2
−1
@@ -119,6 +119,7 @@ spec:
| 119 | 119 | |
| 120 | 120 | imagePullSecrets: |
| 121 | 121 | - name: gitlabgmp |
| 122 | + priorityClassName: high-priority | |
| 122 | 123 | --- |
| 123 | 124 | apiVersion: v1 |
| 124 | 125 | kind: Service |
@@ -141,7 +142,7 @@ metadata:
| 141 | 142 | spec: |
| 142 | 143 | ports: |
| 143 | 144 | - port: 80 |
| 144 | − targetPort: 4041 | |
| 145 | + targetPort: 4001 | |
| 145 | 146 | protocol: TCP |
| 146 | 147 | selector: |
| 147 | 148 | name: apollos-crib |
modified
apps/room_sanctum/lib/room_sanctum/workers/pythiae_worker.ex
+20
−3
@@ -42,6 +42,13 @@ defmodule RoomSanctum.Worker.Pythiae do
| 42 | 42 | |> GenServer.cast(:query_current) |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | + def query_current_now(name) do | |
| 46 | + "pythiae#{name}" | |
| 47 | + |> via_tuple() | |
| 48 | + |> GenServer.cast(:query_current_now) | |
| 49 | + end | |
| 50 | + | |
| 51 | + | |
| 45 | 52 | # |
| 46 | 53 | def handle_cast(:refresh_db_cfg, state) do |
| 47 | 54 | p = Configuration.get_pythiae!(state[:id]) |
@@ -53,14 +60,24 @@ defmodule RoomSanctum.Worker.Pythiae do
| 53 | 60 | if current != state.vision do |
| 54 | 61 | IO.puts("change detected") |
| 55 | 62 | for a <- state.pythiae.ankyra do |
| 56 | − RoomSanctum.Worker.Ankyra.publish(a, current.data |> json_friendly_keys) | |
| 63 | + RoomSanctum.Worker.Ankyra.publish(a, current.data |> condense) | |
| 57 | 64 | end |
| 58 | 65 | end |
| 59 | 66 | {:noreply, state |> Map.put(:vision, current)} |
| 60 | 67 | end |
| 61 | 68 | |
| 62 | − defp json_friendly_keys(data) do | |
| 63 | − data |> Enum.map( fn {{id, type}, v} -> {"#{type}-#{id}", v} end) |> Enum.into(%{}) | |
| 69 | + def handle_cast(:query_current_now, state) do | |
| 70 | + current = RoomSanctum.Worker.Vision.get_state(state.pythiae.curr_vision) | |
| 71 | + for a <- state.pythiae.ankyra do | |
| 72 | + RoomSanctum.Worker.Ankyra.publish(a, current.data |> condense) | |
| 73 | + end | |
| 74 | + {:noreply, state |> Map.put(:vision, current)} | |
| 75 | + end | |
| 76 | + | |
| 77 | + defp condense(data) do | |
| 78 | + data |> Enum.map( fn {{id, type}, datum} -> | |
| 79 | + IO.inspect({id, type, datum}) | |
| 80 | + {"#{type}-#{id}", RoomSanctum.Condenser.BasicMQTT.condense({id, type}, datum)} end) |> IO.inspect |> Enum.into(%{}) | |
| 64 | 81 | end |
| 65 | 82 | |
| 66 | 83 |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.ex
+5
−0
@@ -30,4 +30,9 @@ defmodule RoomSanctumWeb.PythiaeLive.Show do
| 30 | 30 | end |
| 31 | 31 | |
| 32 | 32 | end |
| 33 | + | |
| 34 | + def handle_event("do-publish", %{"id" => id}, socket) do | |
| 35 | + RoomSanctum.Worker.Pythiae.query_current_now(id) | |
| 36 | + {:noreply, socket} | |
| 37 | + end | |
| 33 | 38 | end |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.html.heex
+1
−1
@@ -72,7 +72,7 @@
| 72 | 72 | <div class="card card-compact w-1/5 bg-base-100 shadow-xl m-2"> |
| 73 | 73 | <div class="card-body"> |
| 74 | 74 | <h3 class="card-title">Control</h3> |
| 75 | − <p><button class="btn btn-primary">Publish</button></p> | |
| 75 | + <p><button class="btn btn-primary" phx-click="do-publish" phx-value-id={@pythiae.id}>Publish</button></p> | |
| 76 | 76 | </div> |
| 77 | 77 | </div> |
| 78 | 78 | <div class="card card-compact w-4/5 bg-base-100 shadow-xl m-2"> |
modified
apps/room_tidal/mix.exs
+8
−0
@@ -25,6 +25,14 @@ defmodule RoomTidal.MixProject do
| 25 | 25 | # Run "mix help deps" to learn about dependencies. |
| 26 | 26 | defp deps do |
| 27 | 27 | [ |
| 28 | + {:nebulex, "~> 2.4"}, | |
| 29 | + # => When using :shards as backend | |
| 30 | + {:shards, "~> 1.0"}, | |
| 31 | + # => When using Caching Annotations | |
| 32 | + {:decorator, "~> 1.4"}, | |
| 33 | + {:telemetry, "~> 1.0"}, | |
| 34 | + | |
| 35 | + | |
| 28 | 36 | {:httpoison, "~> 1.8"}, |
| 29 | 37 | {:parent, "~> 0.12.1"}, |
| 30 | 38 | {:room_sanctum, in_umbrella: true} |
Parents: 793c944