Managing entries

Grigori Fursin edited this page Jun 5, 2018 · 6 revisions

[ Home ]

You can read about basic CK functionality to add, delete, load and move entries in the Getting Started Guide. Here we provide some extra tricks and tips.

Table of Contents

Detecting CK entry in a current directory

User can detect if a current directory belongs to some CK entry as follows:

 ck cid

Managing entries from OS shell

Note, that when you are in any OS shell and your current directory is inside CK repo, you can prefix CID with # on Windows or ^ on Linux, and CK will try to auto-complete repo_uoa, module_uoa and data_uoa.

For example, if you are inside $HOME/CK/local/test directory, you can add a new test entry abc simply as follows:

 $ ck add ^abc

You can also rename this entry via

 $ ck mv ^abc ^xyz

On Windows you will need to do the following:

 $ ck add #abc
 $ ck mv #abc #xyz

Listing entries

It is possible to list all entries in the system as follows (very fast unlike ''search'' function) :

 ck list

or as full CID (repo_alias:module_alias:data_alias)

 ck list --all

or with brief description (if provided)

 ck list --all --print_name 

It is possible to prune list by fixing repo_alias, module_alias and data_alias or using wildcards * and ? as follows:

 ck list my-repo::
 ck list my-repo:test:
 ck list test:
 ck list t*:
 ck list :uni*

Loading entries from remote repo

An important feature of CK are remote repositories that are accessed just as local ones (via CK JSON API). For example, it is possible to load meta description of a test:unicode entry from remote-ck repository (points to [cknowledge.org/repo]) as follows:

 ck load remote-ck:test:unicode

In fact, it is possible to perform most of the actions on the remote repository as if it is the local one:

 ck list remote-ck:module:

This dramatically simplifies creation of experiment crowdsourcing such as our software and hardware crowd-tuning scenario.

Moving files

A user can move any files and directories to a given entry using OS commands. However, when user would like to move files to a remote repository, CK should be used as follows:

 ck push test:abc <filename>

Hence, it's a preferable way to push files to any repository including local ones.

If a file is a zip archive, it is possible to push and unzip the file as follows

 ck push test:abc <filename.zip> --archive

It is possible to list available files in a given entry as follows:

 ck list_files test:unicode

It is also possible to pull file from a given entry (even in a remote server) to a current directory as follows:

 ck pull test:unicode ck_logo.png
 ck pull remote-ck:test:unicode ck_logo.png

It is possible to pull all files as zip archive from a given entry:

 ck pull remote-ck:test:unicode --archive
and even add meta description:
 ck pull remote-ck:test:unicode --archive --all

Locking entries

When updating entries on remote repositories (for example, when aggregating experimental results), there may be natural concurrent accesses. We provided a simple and coarse-grain locking mechanism to allow concurrent read/writes.

A user can lock a given entry as follows:

 ck load test:abc --get_lock

This command will set a lock for this entry for some time (usually 30 sec.) while blocking other users from writing. This command will also return a lock_uid=UID. Now, user can update an entry and unlock it as follows:

 ck update test:abc --unlock_uid=UID

Questions and comments

You are welcome to get in touch with the CK community if you have questions or comments!

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.