Upgrade from Juturna 2.x¶
Juturna 3.0 changes where nodes live, how they are named in a configuration, and a few parts of the Python API. This guide lists what to change, in the order you are likely to meet it. Most projects need the first three sections only.
1. Install the nodes¶
The core library no longer contains nodes, and the hub that downloaded plugins is gone. The official nodes are now a package of their own:
(.venv) $ pip install -U juturna juturna-nodes
Not every 2.x node made the move: check the README of juturna-nodes for the list. A node that is missing, like any node of your own, has to be ported (section 3).
2. Update the configuration files¶
Node types. A node was named by type (source, proc, sink)
and mark. Now type alone holds the class of the node, and mark is
gone:
{ "name": "src", "type": "source", "mark": "audio_rtp", "configuration": {} }
becomes
{ "name": "src", "type": "AudioRtp", "configuration": {} }
Some of the nodes you may be using:
2.x |
Closest 3.0 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The arguments of a node may have changed with it: compare your
configuration with the config.toml of the new node.
Plugins. The top-level plugins key is ignored: nodes are found among
the installed packages, not in folders. Remove it.
Telemetry. "telemetry": "file.csv" becomes an object:
"telemetry": { "name": "csv", "target": "file.csv" }
The file is written in the pipeline folder, its name must end with .csv,
and it has one more column (worker).
Synchronisers. The sync key of a node is ignored (see section 3).
When you are done, let Juturna check the result:
(.venv) $ python -m juturna validate --config pipeline.json
3. Port your own nodes¶
Move them into a package. Nodes are no longer loaded from a plugins
folder. They live in an installable package, under
juturna.contrib.<package>.nodes, and are used with the type
contrib.<package>.nodes.<Class>. The quickest way is to create the
skeleton with python -m juturna stub and move your code in:
Write and package a node has the details.
Accept the state. update() now receives the node state as a keyword
argument. A node with the old signature fails on every message:
# 2.x
def update(self, message: Message):
...
# 3.0
def update(self, message: Message, **kwargs):
...
Replace buffers and synchronisers. The node buffer, the synchronisers and
next_batch() were removed. A node now receives its messages one at a
time, in order of arrival, and message.creator tells which node sent each
one. A node that waited for a message from each of its inputs keeps the
pending ones in kwargs['state']: there is an example in
Nodes.
Transmit messages only. transmit() and source functions deal in
Message objects. Anything else is refused and logged (a source function
can still return None when it has nothing to deliver).
Do not change received messages. Freezing now reaches nested meta
values and the arrays of a payload. To send a received message on with
changes, use message.copy():
to_send = message.copy(creator=self.name)
to_send.meta['checked'] = True
self.transmit(to_send)
Removed names. If your code uses one of these, here is what to do:
Removed |
Instead |
|---|---|
|
Install node packages with |
|
Keep pending messages in the node state. |
|
No replacement. |
|
Not needed: an exception in |
4. Pipelines in your own code¶
A stopped pipeline cannot be started again. Destroy it and create a new one.
A lifecycle call in the wrong state raises a specific exception (
PipelineNotReadyError,PipelineStoppedError, …) fromjuturna.components. They all derive fromRuntimeError, so existingexcept RuntimeErrorblocks keep working.stop()waits for the nodes to finish what they received. The newkill()does not: use it when a node may hang.Two
ObjectPayloadare now equal when their content is, and anObjectPayloadcan no longer be a dictionary key or a set item.
5. Command line¶
Command |
What changed |
|---|---|
|
Removed. The dependencies of a node are those of its package. |
|
|
|
|
|
Takes no |
|
|
|
|
6. The pipeline service¶
If you have clients of python -m juturna serve:
every request needs
Authorization: Bearer <token>, with the token of theJUTURNA_SERVICE_TOKENvariable of the service (see Run pipelines behind an HTTP service);a configuration that reads environment variables with
$JT_ENV_is refused, unless the variable is in the file given to the service with--env-fileor allowed with--allow-env(see Use environment variables in a configuration);a mistake in a request (a broken configuration, a node type that is not installed) is answered with a
4xxstatus and a message, where it often was a500.
7. Remote nodes¶
The
Warpnode moved tojuturna-nodes: installjuturna-nodes[warp]where the pipeline runs.The remote protocol changed, and is now versioned. Upgrade the pipeline side and the remote service together: a 2.x side and a 3.0 side do not understand each other.
The remote service listens on the loopback address by default. A service that must be reached from other machines needs
--host(see Run a node on another machine).