{"id":20174041,"url":"https://github.com/joergen7/cf_client","last_synced_at":"2025-04-10T03:36:00.253Z","repository":{"id":57482606,"uuid":"111285474","full_name":"joergen7/cf_client","owner":"joergen7","description":"Cuneiform client implementation","archived":false,"fork":false,"pushed_at":"2025-02-07T08:33:26.000Z","size":592,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T09:16:16.071Z","etag":null,"topics":["client","cuneiform","erlang","otp","programming-language"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/cf_client","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joergen7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-19T10:32:52.000Z","updated_at":"2025-02-07T08:33:30.000Z","dependencies_parsed_at":"2025-02-06T15:39:08.313Z","dependency_job_id":"c5d600eb-6688-4757-9a99-b6cd8df135e2","html_url":"https://github.com/joergen7/cf_client","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joergen7%2Fcf_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joergen7%2Fcf_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joergen7%2Fcf_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joergen7%2Fcf_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joergen7","download_url":"https://codeload.github.com/joergen7/cf_client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248153351,"owners_count":21056415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","cuneiform","erlang","otp","programming-language"],"created_at":"2024-11-14T01:41:11.949Z","updated_at":"2025-04-10T03:36:00.219Z","avatar_url":"https://github.com/joergen7.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cf_client\n###### Cuneiform client implementation\n\n[![hex.pm](https://img.shields.io/hexpm/v/cf_client.svg?style=flat-square)](https://hex.pm/packages/cf_client) [![Build Status](https://travis-ci.org/joergen7/cf_client.svg?branch=master)](https://travis-ci.org/joergen7/cf_client)\n\ncf_client is a client implementation for the common runtime environment (CRE) instantiating an interpreter for the Cuneiform functional language for large-scale data analysis.\n\nThis application packages a Cuneiform scanner and parser, as well as an interpreter that distributes tasks by sending it to a CRE instance. The Cuneiform client can be used to consume a Cuneiform source file from the file system or to start an interactive shell.\n\n## Usage\n\n### Adding the CRE to a Project\n\nAlthough the Cuneiform client application can be imported also directly from GitHub, we recommend adding a dependency via [hex.pm](https://hex.pm). Here, we show how this can be done using the build tools [rebar3](https://www.rebar3.org) or mix.\n\n\n#### rebar3\n\nTo integrate the Cuneiform client application into a rebar3-managed project change the `deps` entry in your application's `rebar.config` file to include the tuple `{cf_client, \"0.1.8\"}`.\n\n```erlang\n{deps, [{cf_client, \"0.1.8\"}]}.\n```\n\n\n#### mix\n\n```elixir\n{:cf_client, \"~\u003e 0.1.8\"}\n```\n\n### Compiling\n\nHaving rebar3 available on your system, compile the project as an Erlang project by entering\n\n    rebar3 compile\n\nIf you want to drive the project from the command line please compile the project by entering\n\n    rebar3 escriptize\n\n### Starting the Cuneiform Client\n\nThe Cuneiform client can be started in several different ways. It can be started from the command line, as an Erlang application, as a supervision tree hosting a single client process, or directly as a process. In all cases there has to be a way for the client to find the CRE instance it connects to.\n\n#### Starting from the Command Line\n\nCompiling the Cuneiform client using `escriptize` creates an Erlang script file `cf_client` which allows starting the Cuneiform client via the command line.\n\nTo display a help text enter\n\n    ./cf_client --help\n\nThis will show the command line synopsis, which looks like the following:\n\n    Usage: cf_worker [-v] [-h] [-s \u003csuppl_file\u003e] [-c \u003ccre_node\u003e]\n\n      -v, --version     Show cf_worker version.\n      -h, --help        Show command line options.\n      -s, --suppl_file  Supplementary configuration file.\n      -c, --cre_node    Erlang node running the CRE application.\n\nTo start the client from the command line and connect with a running CRE instance enter\n\n    ./cf_client -c cre@my_node\n\nHere, we assume that the CRE runs on an Erlang node identified as `cre@my_node`.\n\n#### Starting as an Erlang Application\n\nIf a CRE instance is already running on the same Erlang node you can start the Cuneiform client application by calling\n\n```erlang\ncf_client:start().\n```\n\nWhich is exactly the same as calling\n\n```erlang\napplication:start( cf_client ).\n```\n\n#### Starting Under the Default Supervisor\n\nTo start the Cuneiform client default supervisor under a custom supervision tree enter\n\n```erlang\nCreNode = node().\ncf_client_sup:start_link( CreNode ).\n```\n\nThis will register the Cuneiform client locally under the name `cf_client`.\n\n#### Starting Directly\n\nThe Cuneiform client process can be started directly. There are several ways to do this. The first is to start the process with a function that allows it to locate the CRE:\n\n```erlang\nCreNode = node().\nF = fun() -\u003e cre:pid( CreNode ) end.\n{ok, ClientPid} = cf_client_process:start_link( F ).\n```\n\nGiving a function instead of a plain Cre process identifier has the advantage, that if the CRE crashes, taking the Cuneiform client with it, the restarted client instance connects uses the output of the function, which offers the possibility of locating the CRE under its new process identifier.\n\nIf this is too tedious, one can start it giving the CRE process identifier directly:\n\n```erlang\nCrePid = cre:pid( node() ).\n{ok, ClientPid} = cf_client_process:start_link( CrePid ).\n```\n\nBoth previous direct starting methods do not register the Cuneiform client with any registry service. However, one can register the client process by starting it either with a function:\n\n```erlang\nClientName = cf_client.\nCreNode = node().\nF = fun() -\u003e cre:pid( CreNode ) end.\n{ok, ClientPid} = cf_client_process:start_link( {local, ClientName}, F ).\n```\n\nor with the CRE process identifier:\n\n```erlang\nClientName = cf_client.\nCrePid = cre:pid( node() ).\n{ok, ClientPid} = cf_client_process:start_link( {local, ClientName}, CrePid ).\n```\n\n### Interacting with a Cuneiform Client\n\nAfter starting the Cuneiform client instance one can interact with it by sending it expressions conforming the Cuneiform intermediate representation. The client will reply with the value that corresponds to the expression or with an error term. Communication with the client is synchronous.\n\n#### Sending Cuneiform Expressions\n\nE.g., since strings are values which evaluate to themselves we can give the client a string expression, which it will parrot:\n\n```erlang\nE = cuneiform_lang:str( \u003c\u003c\"bla\"\u003e\u003e ).\ncre_client:eval( cf_client, E ).\n```\n\nHere we assume, that a Cuneiform client instance is running registered locally under `cf_client`.\n\n#### Connecting a Shell\n\nThe Cuneiform client comes with an interactive shell which can be connected to a client instance registered under `cf_client` by entering\n\n```erlang\ncuneiform_shell:shell( cf_client ).\n```\n\nWhich will start a shell that should look like the following:\n\n                ___\n               @@WB      Cuneiform\n              @@E_____\n         _g@@@@@WWWWWWL  Type help for usage info\n       g@@#*`3@B              quit to exit shell\n      @@P    3@B\n      @N____ 3@B         http://www.cuneiform-lang.org\n      \"W@@@WF3@B\n\n\n    1\u003e\n\n## System Requirements\n\n- [Erlang](https://www.erlang.org) OTP 19.0 or higher\n- [Rebar3](https://www.rebar3.org) 3.0.0 or higher\n\n## Resources\n\n- [joergen7/cre](https://github.com/joergen7/cre). A common runtime environment (CRE) for distributed workflow languages.\n- [joergen7/cuneiform](https://github.com/joergen7/cuneiform). A functional language for large-scale data analysis whose distributed execution environment is implemented on top of the CRE.\n\n## License\n\n[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoergen7%2Fcf_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoergen7%2Fcf_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoergen7%2Fcf_client/lists"}