Skip to content

Commit a58c652

Browse files
author
a-tylenda
committed
Add 'Get Instance output' section
1 parent d6f9135 commit a58c652

File tree

4 files changed

+84
-22
lines changed

4 files changed

+84
-22
lines changed

README.md

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ STH allows you to deploy and run multiple data processing apps called Sequences.
5555
<strong>Sequences</strong>
5656
</summary>
5757

58-
**Sequences** are specific apps, not just any apps. They specialize in efficient data processing.
58+
[**Sequences**](dictionary.md#sequence) are specific apps, not just any apps. They specialize in efficient data processing.
5959

6060
We named our apps "Sequences" and that term describes well its nature, as they process data through a Sequence of chained functions. Therefore, usually our Sequences are concise, easy to write and powerful at the same time.
6161
</details>
@@ -76,10 +76,10 @@ What we also do on the host level is that we apply a set of algorithms to optimi
7676

7777
> We call our processing optimization algorithms **"IFCA"** meaning "Intelligent Function Composition Algorithms".
7878
79-
You can interact with host using our dedicated STH CLI that will help you with Sequences deployment, running it and monitoring.
79+
You can interact with host using our dedicated STH CLI that will help you with Sequences deployment, running and monitoring.
8080
</details>
8181
<br>
82-
Our vanilla STH engine is based on Node.js and thus allows developers to benefit from rich ecosystem, numerous packages and solutions provided by this vibrant community.
82+
Our vanilla STH engine is based on Node.js and thus allows developers to benefit from its rich ecosystem, numerous packages and solutions provided by this vibrant community.
8383

8484
### **1.2 Solution concept diagram**
8585

@@ -108,7 +108,7 @@ Our vanilla STH engine is based on Node.js and thus allows developers to benefit
108108

109109
This is a solution for the central processing and management unit with the following major components:
110110

111-
1. **Sequences** - these are the actual "STH" apps. It is a gzipped package (`*.tar.gz`) containing at least two files:
111+
1. **Sequences** - these are the actual "STH" apps. It is a package containing at least two files:
112112
* **package.json** - JSON manifest file describing the app and its configuration; such as main file to run
113113
* **main file** - file such as `index.js` or `index.ts` that contains a lightweight application business logic.
114114
2. **Instance** - once a Sequence is run, the host will create a separate runtime environment for it and will execute Sequence code inside this runtime entity. This is an Instance.
@@ -125,8 +125,8 @@ Our engine outputs can be managed in several ways:
125125

126126
* **File** - you can save your output to a local or a remote file
127127
* **STDOUT** - output can be directed to system STDOUT (STDERR is supported as well)
128-
* **API** - output can be consumed from our STH REST API
129-
* **URL Request** - you can write your app in a way to request URL, webhook etc
128+
* **API** - output can be consumed from our STH REST API
129+
* **URL Request** - you can write your app in a way to request URL, webhook, etc.
130130
* **Stream** - output can be streamed to a particular destination
131131
* you can mix multiple actions together: you can both send data to remote system/URL and save it locally.
132132

@@ -159,6 +159,7 @@ scramjet-transform-hub
159159
```
160160

161161
> 💡 **HINT:** There is also an alias for running STH:
162+
>
162163
>```bash
163164
>sth
164165
>```
@@ -169,7 +170,7 @@ More detailed installation instructions can be found in our [STH GitHub reposito
169170
170171
### **3.1 Review the package**
171172
172-
Before running our first Sequence let's have a quick look what's inside the Sequence package.
173+
Before running your first Sequence let's have a quick look what's inside the Sequence package.
173174
174175
We have prepared for you a simple JavaScript sample Sequence "hello-snowman". This Sequence is available in the directory `samples/hello-snowman` in this repository. In this directory you will find two files:
175176
@@ -254,13 +255,22 @@ Now we have uploaded Sequence to the host and host assigned to it a random ID (G
254255
<strong>3. Run the Sequence</strong>
255256
</summary>
256257
257-
We can now use Sequence ID to start uploaded Sequence. The command is `si seq start <sequence_id>`. You can also pass arbitrary number of parameters by providing them after `<sequence_id>`, in case of our `hello-snowman` no parameters are used.
258+
We can now use Sequence ID to start uploaded Sequence. The command is `si seq start <sequence_id>`. To make our users life easier we provided an alias for Sequence ID: `si seq start -`. This CLI functionality replaces `-` argument with the last item the user interacted with or `select`ed.
259+
260+
Also, an arbitrary number of parameters can be passed to a Sequence while `start`ing by providing them after `<sequence_id>` or `-` alias. In case of our `hello-snowman` no parameters are used.
261+
258262
Use the following command to start the Sequence:
259263
260264
```bash
261265
si sequence start cf775cc1-105b-473d-b929-6885a0c2182c
262266
```
263267
268+
or
269+
270+
```bash
271+
si sequence start -
272+
```
273+
264274
The output will look similar to this one:
265275
266276
```bash
@@ -336,7 +346,7 @@ Our Sequence generator app does two things here:
336346
* Sends stream of messages; each one containing number with temperature value
337347
* Reads output from Host API that is generated by our `hello-snowman` Sequence
338348
339-
Separately, you can also open a new terminal window and see log of this particular Instance with command `si instance log <instance_id>`. In our case this would be:
349+
Separately, you can also open a new terminal window and see log of this particular Instance with command `si instance log <instance_id>` or by using alias `si instance log -`. In our case this would be:
340350
341351
```bash
342352
si instance log e70222d1-acfc-4e00-b046-4a3a9481c53b
@@ -345,18 +355,72 @@ si instance log e70222d1-acfc-4e00-b046-4a3a9481c53b
345355
The sample output will be similar to this one:
346356
347357
```bash
358+
Request ok: http://127.0.0.1:8000/api/v1/instance/e70222d1-acfc-4e00-b046-4a3a9481c53b/log status: 200 OK
359+
{"level":"DEBUG","msg":"Streams initialized","ts":1647447631103,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"}}
360+
{"level":"TRACE","msg":"Handshake sent","ts":1647447631103,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"}}
361+
{"level":"DEBUG","msg":"Control message received","ts":1647447631113,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":[4000,{"appConfig":{},"args":[]}]}
362+
{"level":"DEBUG","msg":"Handshake received","ts":1647447631113,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"}}
363+
{"level":"DEBUG","msg":"Sequence","ts":1647447631115,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":[[null]]}
364+
{"level":"INFO","msg":"Sequence loaded, functions count","ts":1647447631116,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":[1]}
365+
{"level":"DEBUG","msg":"Processing function on index","ts":1647447631116,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":[0]}
366+
{"level":"DEBUG","msg":"Function called","ts":1647447631116,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":[0]}
367+
{"level":"INFO","msg":"All sequences processed.","ts":1647447631116,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"}}
368+
{"level":"DEBUG","msg":"Stream type is","ts":1647447631116,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":["object"]}
369+
{"level":"TRACE","msg":"Piping sequence output","ts":1647447631117,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":["object"]}
370+
{"level":"DEBUG","msg":"Content-Type","ts":1647447645282,"from":"Runner","Runner":{"id":"e70222d1-acfc-4e00-b046-4a3a9481c53b"},"data":["application/octet-stream"]}
348371
...
349-
2021-08-09T04:29:39.790Z log (object:Runner) Input message <Buffer 32 30>
350-
2021-08-09T04:29:40.791Z log (object:Runner) Input message <Buffer 2d 34>
351-
2021-08-09T04:29:41.792Z log (object:Runner) Input message <Buffer 33 33>
352-
2021-08-09T04:29:42.798Z log (object:Runner) Input message <Buffer 2d 34 35>
353-
2021-08-09T04:29:43.801Z log (object:Runner) Input message <Buffer 2d 33 36>
354-
...
372+
```
373+
374+
</details>
375+
376+
<details>
377+
<summary>
378+
<strong>5. Get the Instance output</strong>
379+
</summary>
380+
381+
Once `hello-snowman` Sequence is up and running, we have also sent some input data to the Instance to consume. To see what the program does to this data use the command below, it will show you the Instance output after data transformation. Open one more terminal and paste:
382+
383+
```bash
384+
si inst output e70222d1-acfc-4e00-b046-4a3a9481c53b
385+
```
386+
387+
or by using alias
388+
389+
```bash
390+
si inst output -
391+
```
392+
393+
This is an example output that you should get:
394+
395+
```bash
396+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
397+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
398+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
399+
Snowman ⛄ is melting! 🥵
400+
Snowman ⛄ is melting! 🥵
401+
Snowman ⛄ is melting! 🥵
402+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
403+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
404+
Snowman ⛄ is melting! 🥵
405+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
406+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
407+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
408+
Snowman ⛄ is melting! 🥵
409+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
410+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
411+
Snowman ⛄ is melting! 🥵
412+
Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄️ ❄️
355413
```
356414
357415
</details><br>
358416
359-
> 🎉 Congratulations! 🥳 You have run your first Scramjet Transform Hub Sequence!
417+
🎉 Congratulations! 🥳 You have run your first Scramjet Transform Hub Sequence!
418+
419+
> To see more Sequence or Instance CLI commands use `si help` accordingly:
420+
>
421+
>* `si seq help`
422+
>
423+
>* `si inst help`
360424
361425
## **4. Where to go next**
362426

dictionary.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Software Development Kit. A collection of tools and libraries to create a softwa
261261

262262
### Sequence
263263

264-
It is a compressed package (`*.tar.gz`) containing file with a manifest(eg. `package.json`), describing the app and its configuration (such as main file to run); and a **main file** (eg. `index.js`, `app.ts`) that contains a developer's code that consists of chained functions with a lightweight application business logic . Minimal sequence consists of 1 [function](#function).
264+
It is a package (application) containing a set of files. A file with a manifest(eg. `package.json`), describing the app and its configuration (such as main file to run); and a __main file__ (eg. `index.js`, `app.ts`) that contains a developer's code that consists of chained functions with a lightweight application business logic. Minimal Sequence consists of 1 [function](#function).
265265

266266
### Socket
267267

@@ -277,9 +277,7 @@ standard input/standard output. Application communication channels with the outs
277277

278278
### STH <!--TODO-->
279279

280-
### Supervisor
281-
282-
An application supervising work of a single [instance](#instance). Communicates with [host](#host), returns health status of the sequence, runner, etc
280+
shortcut for Scramjet Transform Hub
283281

284282
### Synchronous
285283

samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Samples
22

3-
We have prepared some samples for you. We differentiated them according to the language in which they were written.
3+
Try out our samples prepared some samples for you. We differentiated them according to the language in which they were written.
44

55
> 💡 **Please note that samples below require some previous installations before you start running them. Instructions are [here](../README.md#3-install-scramjet-transform-hub).**
66

templates/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You can use it as a base for your own samples 👉 [sample template](https://git
99

1010
In the following sections we will describe both templates' contents and show you how they can be used in your own project.
1111

12-
## Work with JavaScript (Node.js)
12+
## Work with JavaScript (Node.js)
1313

1414
This application package template contains two files:
1515

0 commit comments

Comments
 (0)