Skip to content

Commit

Permalink
SY-1438 basic calculated channels (#995)
Browse files Browse the repository at this point in the history
* checkpoint

* checkpoint

* [doodle] - doggy

* checkpoint

* [checkpoint]

* checkpoint

* [computron] - simplified package

* [computron] - updated embedded logic

* [computron] - improved unsafe slice data access

* [computron] - separated build files for different OSes

* [computron] - mod tidy

* [console] - fixed modal positioning

* [computron] - simplified expressions and reduced amount of code

* [synnax] - touch ups to calculated channel service

* [synnax] - fixed issues with renaming multiple channels of different types (virtual, free virtual, persisted)

* [console] - re-added monaco editor to package.json

* [synnax] - fixed merge conflict for calculated channels

* [computron] update build script

* checkpoint

* checkpoint

* builds but linking error

* checkpoint - encodings error

* [computron] refactor to have seperate compturon files for windows and unix - need to dedup

* [computron] missed change in mac build script

* [pluto] remove doodle

* [pluto] remove doodle

* [pluto] open edit channel from resource tree

* [console] load in data from the calculated channel when editing

* [api/dist] update calc channels through create pipeline

* [console/client] add tests - still name doesnt get updated in tree but in tests for some reason

* [distribution/channel] can update name as well now

* checkpoint

* checkpoint

* update tests

* [dist] fix tests

* [checkpoint]

* remove unnecessary logs

* remove unrelated changes to py examples

* delete empty files

* remove commented out tests

* address pr comments

* [x/go] add testes for embed

* address more pr comments

* [distribution/channel] refactor createFreVirtual

* [distribution/channel] update tests to retrieve after update:

* [console] refactor calculated modal

* pr comment:

* unfocus test

* nested expression

* add ts test

* address pr comments

* test

* reduce code duplication

* [computron] tests pass on windows

* [computron] removed warnings on windows build

* move python install dir to temp

* [computron] clean up

* use lockTHreadAndGIL

* [console/calc chans] add a hook to update requires list upon opening

* checkpoint

* checkpoint

* [console] lint

* pr comments

* [computron] fix windows path

* [computron] pass python error to log

* [computron/calculated] log warnings

* [console/calc] update schema

* [calculated] improve error handling

* windows installer

* update windows workflow

* handle passing hyphens into the calc expression

* [pkg/service/framer/calc] tests

* [pkg/service/framer/calc] div by zero test

* change hyphen message

* [pkg/service/channel and pkg/service/framer/] update calc expression without hard reloading

* [console/src/channel] add beta tag

* [console/calc] add tooltip

* address pr comments

* set mac version

* update gitignore

* [ci] update server deploy workflow

* [ci] update synnax test workflow

* [pkg/distribution/channe] return

* [computron
] update build for linux

* [dist/channel] update create test

* update workflow file

* build visual studio tools

* update workflow

* add necessary dependencies to computron earthfile

* update linux build script

* [computron] add linux linking flags

* fix linting errors

* lint

* fix ci errors

* lint

* lint

* change linux build steps

* [console] - updated beta-tag on calculations

* [console] - adjusted command selection context

* [console] - addressed pull request comments'

* [computron] - a bit of tuning

* [console] - added variable channel icons

* [pluto] - improved editor CSS styles

* [console] - fixed editor parenthesis color

* [console] - removed unnecessary editor layout

* add explicit linker flags

* build against static python

* add more flags and env vars

* [service/framer] fix downsampling

* fix failing ubuntu typescript test for unsigned/signed cast check

* undo poetry lock chagnes

* format

* pr touchups

* update build python workflow

* move go step

* [console] - changed editor line highlighting

* [synnax] - implemented tests for nested calculations

* [ci] add workflow to run computron tests

* [ci] add step to move python dll

* [synnax] - pr touchups

* allow none for requires or expression

* [x/ts] change form arrow func to exported func

* [console] - fixed imports from unique package

* [synnax] - removed visual studio community installation

---------

Co-authored-by: Emiliano Bonilla <[email protected]>
  • Loading branch information
Lham42 and emilbon99 authored Jan 15, 2025
1 parent c29e639 commit d00964d
Show file tree
Hide file tree
Showing 90 changed files with 3,853 additions and 180 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy.synnax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ jobs:
go-version-file: go.work
cache-dependency-path: go.work.sum

- name: Build Python for Computron
working-directory: computron
run: go generate

- name: Download Dependencies
working-directory: synnax
run: go mod download
Expand Down Expand Up @@ -208,6 +212,50 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
run: gh release upload --clobber synnax-v${{ needs.setup.outputs.VERSION }} ./synnax/synnax-v${{ needs.setup.outputs.VERSION }}-${{ steps.os.outputs.OS }}

- name: Build Windows Installer
if: matrix.platform == 'windows-latest' && needs.setup.outputs.changed == 'true'
shell: powershell
run: |
# Navigate to the synnax binary directory
Push-Location .\synnax
# Read version from VERSION file
$version = Get-Content .\pkg\version\VERSION -Raw
if (-not $version) {
Write-Error "Failed to read version file"
exit 1
}
$version = $version.Trim()
Write-Host "Building version: $version"
# Build the synnax binary
Write-Host "Building synnax binary..."
& go build -o synnax.exe
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to build synnax binary"
exit 1
}
# Navigate back to scripts directory
Pop-Location
# Move the built binary to scripts directory
Write-Host "Moving synnax binary to scripts directory..."
Move-Item -Force .\synnax\synnax.exe .\scripts\
# Copy python DLL
Write-Host "Copying Python DLL..."
Copy-Item -Force .\computron\python_install\bin\python311.dll .\scripts\
# Build the NSIS installer
Write-Host "Building Windows installer..."
& makensis /DVERSION=$version .\scripts\windows-installer.nsi
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to build Windows installer"
exit 1
}
Write-Host "Build process completed successfully!"
- name: Upload Windows Installer
if: matrix.platform == 'windows-latest' && github.event_name == 'push' && needs.setup.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release upload --clobber synnax-v${{ needs.setup.outputs.VERSION }} .\scripts\synnax-setup-v${{ needs.setup.outputs.VERSION }}.exe

- name: Download Latest Earthly
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push'
uses: earthly/actions-setup@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- alamos/go/**
- aspen/**
- cesium/**
- computron/**
- freighter/go/**
- synnax/**
- x/go/**
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/test.computron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test - Computron

on:
push:
branches: [ main, rc ]
paths:
- 'computron/**'
- '.github/workflows/test.computron.yaml'
pull_request:
branches: [ main, rc ]
paths:
- 'computron/**'
- '.github/workflows/test.computron.yaml'
workflow_dispatch:

jobs:
test:
name: Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: go.work.sum

- name: Install Visual Studio Build Tools
if: matrix.os == 'windows-latest'
run: |
choco install visualstudio2022community -y
choco install visualstudio2022-workload-vctools -y
choco install visualstudio2022-workload-nativedesktop -y
- name: Build Python for Computron
working-directory: computron
run: go generate

- name: Download Dependencies
working-directory: computron
run: go mod download

- name: Move Python DLL (Windows)
if: matrix.os == 'windows-latest'
working-directory: computron
run: |
Copy-Item python_install\bin\python311.dll .\ -Force
- name: Run Tests
working-directory: computron
run: go test -v ./...
33 changes: 28 additions & 5 deletions .github/workflows/test.synnax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- main
- rc
workflow_dispatch:

jobs:
changes:
name: Changes
Expand All @@ -32,6 +31,7 @@ jobs:
- alamos/go/**
- aspen/**
- cesium/**
- computron/**
- freighter/go/**
- synnax/**
- x/go/**
Expand All @@ -53,17 +53,40 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4


- name: Build Python On Windows
if: matrix.os == 'windows-latest'
shell: pwsh
working-directory: computron
run: |
./build-windows.ps1
- name: Build Python On Mac
if: matrix.os == 'macos-latest'
shell: bash
working-directory: computron
run: |
chmod +x build-macos.sh
./build-macos.sh
- name: Build Python On Ubuntu
if: matrix.os == 'ubuntu-latest'
shell: bash
working-directory: computron
run: |
chmod +x build-linux.sh
./build-linux.sh
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: go.work.sum

- name: Check Formatting
if: matrix.format
run: scripts/gofmt-check.sh synnax

- name: Test
run: go test -v -shuffle=on ./...
working-directory: synnax
working-directory: synnax
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ work

__pycache__
*_cache/
python_install

# |||| LANDING SITE ||||

Expand Down Expand Up @@ -110,3 +111,4 @@ driver/vendor/mbedtls/mbedtls

# |||| ESLINT ||||
.eslintcache

1 change: 1 addition & 0 deletions .vscode/synnax.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"lineplot",
"Migratable",
"msgpackr",
"mult",
"NavDrawer",
"nsis",
"OPCUA",
Expand Down
2 changes: 1 addition & 1 deletion aspen/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Cluster interface {

// Resolver is used to resolve a reachable address for a node in the cluster.
type Resolver interface {
// Resolve resolves the address of a node with the given Name.
// Resolve resolves the address of a node with the given key.
Resolve(key node.Key) (address.Address, error)
}

Expand Down
2 changes: 1 addition & 1 deletion client/py/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions client/py/synnax/channel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __init__(
key: ChannelKey = 0,
virtual: bool = False,
internal: bool = False,
expression: str = "",
requires: ChannelKeys = [],
_frame_client: FrameClient | None = None,
_client: ChannelClient | None = None,
) -> None:
Expand Down Expand Up @@ -99,6 +101,8 @@ def __init__(
index=index,
internal=internal,
virtual=virtual,
expression=expression,
requires=requires,
)
self.___frame_client = _frame_client
self.__client = _client
Expand Down Expand Up @@ -231,6 +235,8 @@ def create(
index: ChannelKey = 0,
leaseholder: int = 0,
virtual: bool = False,
expression: str = "",
requires: ChannelKeys = [],
retrieve_if_name_exists: bool = False,
) -> Channel | list[Channel]:
"""Creates new channel(s) in the Synnax cluster.
Expand Down Expand Up @@ -277,6 +283,8 @@ def create(
index=index,
is_index=is_index,
virtual=virtual,
expression=expression,
requires=requires,
)
]
elif isinstance(channels, Channel):
Expand Down
2 changes: 2 additions & 0 deletions client/py/synnax/channel/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class ChannelPayload(Payload):
index: ChannelKey = 0
internal: bool = False
virtual: bool = False
expression: str | None = ""
requires: ChannelKeys | None = []

def __str__(self):
return f"Channel(name={self.name}, key={self.key})"
Expand Down
2 changes: 2 additions & 0 deletions client/py/synnax/telem/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ def __init__(
data_type = data_type or data.data_type
data_ = data.data
time_range = data.time_range if time_range is None else time_range
alignment = data.alignment
elif isinstance(data, MultiSeries):
if len(data.series) == 1:
data_type = data_type or data.series[0].data_type
data_ = data.series[0].data
time_range = (
data.series[0].time_range if time_range is None else time_range
)
alignment = data.series[0].alignment
else:
raise ValueError(
"[Series] - MultiSeries with more than one series cannot be converted to a Series"
Expand Down
3 changes: 2 additions & 1 deletion client/py/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ def test_construction_from_list(self):

def test_construction_from_series(self):
"""Should correctly construct the Series from another Series"""
d = Series([1, 2, 3], data_type=DataType.INT8)
d = Series([1, 2, 3], data_type=DataType.INT8, alignment=12)
s = Series(d)
assert len(s) == 3
assert s[2] == 3
assert s.data_type == DataType.INT8
assert s.alignment == 12

def test_construction_from_buffer(self):
"""Should correctly construct the Series from a buffer"""
Expand Down
4 changes: 4 additions & 0 deletions client/ts/src/channel/batchRetriever.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ describe("channelRetriever", () => {
leaseholder: 1,
index: 0,
virtual: false,
expression: "",
requires: [],
}));
});
const retriever = new DebouncedBatchRetriever(base, 10);
Expand Down Expand Up @@ -83,6 +85,8 @@ describe("channelRetriever", () => {
leaseholder: 1,
index: 0,
virtual: false,
expression: "",
requires: [],
}));
});
const retriever = new DebouncedBatchRetriever(base, 10);
Expand Down
Loading

0 comments on commit d00964d

Please sign in to comment.