Workspace and Logic
CLI commands for managing assets in LOC:
- Initialise CLI workspace
- Logic
Also see:
Some commands require to be logged in the LOC server.
Do not manually edit anything under /.loc
- use CLI commands to manage assets instead.
Initialise a CLI Workspace
Requires logged in
loc init [--sync true|false] [WORKSPACE DIR]
Option | Description |
---|---|
--sync true | Synchronise projects from LOC server. If not provided and you have projects on the server, CLI will prompt Would you like to synchronise now? (yes/no) . |
WORKSPACE DIR | Name of the workspace directory to be created. If not provided, the workspace will be default to the current path. |
Re-initialise an existing workspace will clear all of its local logic metadata (while the source files still exist). See loc logic create
for how to add them back.
If you initialise a workspace without logged in, it will only create ./loc/logic-manifest.yaml
which is required to manage logic.
Logic
loc logic
Logic are modulised functions which data processes are consisted of. The source code are managed in the form of script files.
List All Logic
loc logic list|ls [--logic-type <LOGIC TYPE>] [--remote]
Option | Description |
---|---|
--logic-type <LOGIC TYPE> * | Logic type (Generic or Aggregator ) |
--remote | List remote logic on LOC server instead. If not provided, the local logic (deployed or not) would be listed. |
*= will be prompted if not provided
Create a Logic
loc logic create|new [OPTIONS]
Option | Description |
---|---|
--name <NAME> * | Logic name |
--logic-type <TYPE> * | Logic type (Generic or Aggregator ) |
--language <LANGUAGE> * | Logic code language (JavaScript or TypeScript ) |
--entrypoint-file-path <FILENANE> * | Filename of the source logic (by default it would be <logic name>.js or <logic name>.ts ) |
*= will be prompted if not provided
Generic logic source file will be generated under /generic-logic-source/
and aggregator logic at /aggregator-logic-source/
, with related metadata updated in /.loc/logic-manifest.yaml
.
If a source file already exists while creating a logic, the file will not be overwritten.
Build and Deploy Logic
loc logic build [-a|--all] [logic names]
To build (compile) and upload logic to LOC server, which will become native logic.
Option | Description |
---|---|
-a | --all | Build all logic in current workspace (overrides logic names ) |
logic names * | Names of logic to be built and deployed (seperated by spaces). |
*= will be prompted if not provided
Deploying a new source logic will update its ID in /.loc/logic-manifest.yaml
, whereas deploying a modified local logic will updates its revision number (ID unchanged).
A new revision of a deployed logic has to be manually linked (using loc dp edit
) into data processes to be used.
If a logic is already deployed, deploying the unmodified source logic will not create a new revision.
Only source files exists in /.loc/logic-manifest.yaml
can be deployed.
Edit Logic Metadata
loc logic edit [--name <NAME>]
Edit name, description and filename of a logic (does not affect the source code). CLI will prompt you for these options.
Option | Description |
---|---|
--name <NAME> | Name of logic to be edited |
Delete Logic
loc logic delete [--logic-type <LOGIC TYPE>] [--remote]
Option | Description |
---|---|
--logic-type <LOGIC TYPE> * | Logic type (Generic or Aggregator ). Will be prompted by CLI if not provided. |
--remote | Delete remote logic on LOC server and remove its ID from local workspace. If not provided, local logic (deployed or not) would be deleted. |
*= will be prompted if not provided
A logic cannot be deleted if it is linked to any data process. Use loc dp edit
to unlink it and update the data process with loc project deploy
.