Getting Started
 
Notifications
Clear all

[Sticky] Getting Started  


cloudcell
Posts: 3
Admin
Topic starter
(@cloudcell)
Administrator
Joined: 7 months ago

Starting a Project

To automate a process, you have to create a new project by clicking on the "new project" icon, select a folder where you want your project to run and click 'Open.'

Adding a Code Block

To add a block on the canvas, click on the "+" icon. A library window should appear with a list of available blocks. Select a block which you want to be added. Move it on the canvas to where you want. Add a second block in the same manner and connect 'outputs' of one block to 'inputs' of blocks that are going to use the data that the first block produces.

As a simple example, you can choose two RNG blocks and one MULTIPLY block. Then you can connect outputs of the RNG blocks to inputs of the MULTIIPLY block and run a graph.

Running a Graph

After you have created a graph, make sure all the input nodes are connected to sources of data they are going to be using; otherwise, the system will not run the graph. Once you have designed the graph, press the 'Play' button of the menu. You should see the following on your screen:

Spoiler
screenshot

Each block will display the status of the script: "Waiting," "Running," or "Ready" (for blocks that are waiting their turn, running, or have been successfully run).

Modifying Blocks That Have Been Put on the Canvas

If you want to adjust a script, you can find which folder to go to by using the Id of the folder displayed in the status line at the bottom left corner of the program window. So you can go to the project folder and find the block subfolder with this name, open it and edit the script.

Creating New Blocks

To create a new block you have to go to the library folder, inside the same folder as where your executable resides and create a folder with the name of your block. Then you have to create the following files:
1. "sockets_i.meta" -- a text file which lists all the input sockets of the block
2. "sockets_o.meta" -- a text file which lists all the output sockets of the block
Each socket name must start with a new line. So a typical input socket will have the following definition:
[], where the part within the square brackets ("[]") is optional.
3. "run.meta" -- a text file whose first line states the name of the executable and second line -- the name of the script that the executable must run. For example a block running code in R will have the following two lines:

Rscript
block.MULTIPLY.R

After you have created the block, it becomes available in the library. Any folder that resides in the library folder (you can set it via "Settings"("Gear") menu) and has the file "run.meta" is treated as a block.

Writing Code for Blocks

At design time (during the time a graph is built on the canvas), the pxWorks creates a file "paths.meta" automatically within the project folder in each block folder that has inputs. This file lists paths to data files the block takes as inputs. The paths are listed in the same order as inputs in the file "sockets_i.meta." Therefore, to correctly process the file, your code should read the file "paths.meta," get the paths to the data and read that data into memory to process it.

Then the code should save output data using file name(s) that are the same as names of output sockets, specified in the file "sockets_o.meta." This will enable dependent blocks to find this data correctly.

How pxWorks Processes Graphs

At run time (when the program processes the graph and runs the code associated with each block), the order of execution of each block is determined by the readiness of data for each block. In other words, the following happens:
1. If a block has no data inputs, it is run first. If there are several such blocks, they are run simultaneously.
2. As soon as all the data inputs become available for any block, that block is run. All the blocks that can be run simultaneously, are run at the same time.

 

 

Topic Tags
Share: