Package rjazz. R topics documented: March 21, 2018

Similar documents
Armide Documentation. Release Kyle Mayes

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

What is PHP? [1] Figure 1 [1]

Python Working with files. May 4, 2017

Package fst. December 18, 2017

Package sfc. August 29, 2016

Arithmetic and Bitwise Operations on Binary Data

Package tensorflow. January 17, 2018

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Package fst. June 7, 2018

Hash Table and Hashing

Package remotes. December 21, 2017

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

PHP. Interactive Web Systems

CS 231 Data Structures and Algorithms, Fall 2016

Package rtika. May 2, 2018

Package clipr. June 23, 2018

I hate money. Release 1.0

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

ndeftool documentation

Package JGR. September 24, 2017

f5-icontrol-rest Documentation

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

c-lambda: C FFI via raco ctool

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Alarm Counter. A Ceilometer OpenStack Application

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Package fastdummies. January 8, 2018

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

COMP 321: Introduction to Computer Systems

BASIC ELEMENTS OF A COMPUTER PROGRAM

Package cloudml. June 12, 2018

Package elasticsearchr

GMA024F0. GridDB Web API Guide. Toshiba Digital Solutions Corporation 2017 All Rights Reserved.

Package robotstxt. November 12, 2017

SWEN-250 Personal SE. Introduction to C

Package autoshiny. June 25, 2018

Variables and Functions. ROBOTC Software

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3).

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

Package imgur. R topics documented: December 20, Type Package. Title Share plots using the imgur.com image hosting service. Version 0.1.

Open-O Command- Line Interface (CLI)

Language Reference Manual

Objectives. In this chapter, you will:

Package redux. May 31, 2018

Package desc. May 1, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package rngtools. May 15, 2018

Package PKI. September 16, 2017

COMP 2718: Shell Scripts: Part 1. By: Dr. Andrew Vardy

Full file at

Variables, Constants, and Data Types

Package UNF. June 13, 2017

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Package datasets.load

Package lvec. May 24, 2018

Package readxl. April 18, 2017

Package tiler. June 9, 2018

R topics documented: 2 clone

Package reportr. October 6, 2016

TED Language Reference Manual

Package htmlwidgets. July 10, 2017

Package snakecase. R topics documented: March 25, Version Date Title Convert Strings into any Case

C++ Programming: From Problem Analysis to Program Design, Third Edition

Package loggit. April 9, 2018

Introduction to Computer Science Midterm 3 Fall, Points

Package csvread. August 29, 2016

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

User Group Configuration

Package reticulate. November 24, 2017

Rest Client for MicroProfile. John D. Ament, Andy McCright

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

Package dotcall64. January 11, 2018

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3 5 CHAPTER 4. Algorithm Design & Problem Solving. Data Representation.

Arithmetic and Bitwise Operations on Binary Data

Package rdryad. June 18, 2018

code://rubinius/technical

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package rstream. R topics documented: June 21, Version Date Title Streams of Random Numbers

Package readobj. November 2, 2017

Package plusser. R topics documented: August 29, Date Version Title A Google+ Interface for R

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Programming Lecture 3

Programming refresher and intro to C programming

Fundamentals: Expressions and Assignment

CS113: Lecture 7. Topics: The C Preprocessor. I/O, Streams, Files

JavaScript: Introduction, Types

Package oec. R topics documented: May 11, Type Package

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

bulbea Release 0.1.0

CS3157: Advanced Programming. Outline

Package ssh. June 4, 2018

Language Reference Manual simplicity

CS61C Machine Structures. Lecture 3 Introduction to the C Programming Language. 1/23/2006 John Wawrzynek. www-inst.eecs.berkeley.

BlackBerry Software Development Kit Version 2.5. System Utilities API Reference Guide

Package confidence. July 2, 2017

egrapher Language Reference Manual

Transcription:

Type Package Title Official Client for 'Jazz' Version 0.1.7 Date 2018-03-19 Depends R (>= 3.1.0) Imports stats, RCurl Package rjazz March 21, 2018 This is the official 'Jazz' client. 'Jazz' is a lightweight modular data processing framework, including a web server. It provides data persistence and computation capabilities accessible from 'R' and 'Python' and also through a REST API. <https://github.com/bbvadata/jazz> See?rjazz::rjazz to get a 'Jazz' server. License Apache License (== 2.0) NeedsCompilation no Author Santiago Basaldua [aut, cre], Banco Bilbao Vizcaya Argentaria, S.A. [cph] Maintainer Santiago Basaldua <kaalam@kaalam.ai> Repository CRAN Date/Publication 2018-03-21 11:25:10 UTC R topics documented: rjazz-package........................................ 2 create_block_rep...................................... 3 create_block_seq...................................... 4 create_error_page...................................... 5 create_source........................................ 6 create_web_resource.................................... 7 delete_block......................................... 8 delete_source........................................ 9 delete_web_source..................................... 10 get_block_as_string..................................... 11 get_block_attributes..................................... 13 get_raw_block........................................ 15 1

2 rjazz-package get_r_block......................................... 16 get_server_version..................................... 17 license............................................ 18 list_sources......................................... 18 list_web_sources...................................... 19 new_key........................................... 20 notice............................................ 20 put_block_flags....................................... 21 put_raw_block....................................... 22 put_r_block......................................... 24 put_strings_as_block.................................... 25 set_compatible_data_type.................................. 27 set_jazz_........................................ 29 type_const.......................................... 30 Index 31 rjazz-package Official Client for Jazz How to get a Jazz server Currently, in March 2018, Jazz is in the middle of major refactoring. The client is released mainly for supporting Jazz development, evaluation purposes and keeping a stable package name for the future. Unless you are interested in Jazz core development, we recommend you to wait until version 0.3.1 before giving Jazz a serious evaluation. Run a docker image from docker hub (hub.docker.com) This is fastest way for evaluation purposes. Check dockerhub to find the name of the latest image. docker run -p8888:8888 kaalam/jazz_neat:0.2.1.99 Compile from source The most controlable way is to compile the server from source. git clone https://github.com/bbvadata/jazz cd Jazz./config.sh cd server make jazz./jazz start You can point a browser at http://local:8888/// to check if the server is running.

create_block_rep 3 create_block_rep Create a data block in the server by repeating a value a number of times Creates a (boolan, integer, real or string) data block in the server and stores it in the persistence by repeating a value a number of times. The type of the block can later be changed to a compatible type: BLOCKTYPE_C_INTEGER to BLOCKTYPE_C_FACTOR or BLOCKTYPE_C_GRADE and BLOCKTYPE_C_REAL to BLOCKTYPE_C_TIMESEC by a later call to set_compatible_data_type(). create_block_rep(source, block_key, val, times, =..) source block_key val times The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The (boolan, integer, real of string) value to be repeated. A single element of type logical, integer, numeric or character. The number of times to be repeated. A number. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_put') create_block_rep('demo_put', 'bool_1', TRUE, 3) any(rep(true, 3)!= get_r_block('demo_put', 'bool_1')) create_block_rep('demo_put', 'int_1', 2L, 4) any(rep(2l, 4)!= get_r_block('demo_put', 'int_1')) create_block_rep('demo_put', 'real_1', 3.14, 5) any(rep(3.14, 5)!= get_r_block('demo_put', 'real_1'))

4 create_block_seq create_block_rep('demo_put', 'str_1', 'Hi!', 6) any(rep('hi!', 6)!= get_r_block('demo_put', 'str_1')) create_block_seq('demo_put', 'int_2', 456L, 999L, 123L) any(seq(456l, 999L, 123L)!= get_r_block('demo_put', 'int_2')) create_block_seq('demo_put', 'real_2', 0.123, 4.56, 0.789) any(seq(0.123, 4.56, 0.789)!= get_r_block('demo_put', 'real_2')) delete_source('demo_put') create_block_seq Create a data block in the server with a simple linear sequence Creates an (integer or real) data block in the server and stores it in the persistence with a simple linear sequence. The type of the block can later be changed to a compatible type: BLOCK- TYPE_C_INTEGER to BLOCKTYPE_C_FACTOR or BLOCKTYPE_C_GRADE and BLOCK- TYPE_C_REAL to BLOCKTYPE_C_TIMESEC by a later call to set_compatible_data_type(). create_block_seq(source, block_key, from, to, by = 1, =..) source block_key from to by The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The starting value. A real number or an integer. The end value, may not be included, it is the supremum or the infimum when by is negative. The increment. It may be negative, in that case from must be bigger than to. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure.

create_error_page 5 create_source('demo_put') create_block_rep('demo_put', 'bool_1', TRUE, 3) any(rep(true, 3)!= get_r_block('demo_put', 'bool_1')) create_block_rep('demo_put', 'int_1', 2L, 4) any(rep(2l, 4)!= get_r_block('demo_put', 'int_1')) create_block_rep('demo_put', 'real_1', 3.14, 5) any(rep(3.14, 5)!= get_r_block('demo_put', 'real_1')) create_block_rep('demo_put', 'str_1', 'Hi!', 6) any(rep('hi!', 6)!= get_r_block('demo_put', 'str_1')) create_block_seq('demo_put', 'int_2', 456L, 999L, 123L) any(seq(456l, 999L, 123L)!= get_r_block('demo_put', 'int_2')) create_block_seq('demo_put', 'real_2', 0.123, 4.56, 0.789) any(seq(0.123, 4.56, 0.789)!= get_r_block('demo_put', 'real_2')) delete_source('demo_put') create_error_page Customize the error pages on the server Defines a new page for any http error status. These pages are always html (mime = text/html) but can use any number of resources (css, png, js,...) which must be uploaded appropriately using link_web_resource(). create_error_page(http_status, html, =..) http_status html The http status code returned as an error. Only those specified in Jazz API. E.g., 400 (Bad Request) - Syntactical error at top level. (Malformed URI) The html page to be served for that error. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_().

6 create_source Returns TRUE on success or throws an error on failure. page <- '<html>\n<body>\n<br/>resource was not found on this node.\n</body>\n</html>' create_error_page(404, page) create_source Create a new source on the server Creates a new source on the server. You must be authorized to create sources. The server has a maximum number of sources that is configured through the C++ MAX_POSSIBLE_SOURCES and the configuration variable MDB_ENV_SET_MAXDBS including sys and www. create_source(source, =..) source The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_put') create_block_rep('demo_put', 'bool_1', TRUE, 3) any(rep(true, 3)!= get_r_block('demo_put', 'bool_1')) create_block_rep('demo_put', 'int_1', 2L, 4) any(rep(2l, 4)!= get_r_block('demo_put', 'int_1')) create_block_rep('demo_put', 'real_1', 3.14, 5)

create_web_resource 7 any(rep(3.14, 5)!= get_r_block('demo_put', 'real_1')) create_block_rep('demo_put', 'str_1', 'Hi!', 6) any(rep('hi!', 6)!= get_r_block('demo_put', 'str_1')) create_block_seq('demo_put', 'int_2', 456L, 999L, 123L) any(seq(456l, 999L, 123L)!= get_r_block('demo_put', 'int_2')) create_block_seq('demo_put', 'real_2', 0.123, 4.56, 0.789) any(seq(0.123, 4.56, 0.789)!= get_r_block('demo_put', 'real_2')) delete_source('demo_put') create_web_resource High level create a new association of an url from an object This completely adds a resource to the web interface. The resource has to be created inside a web source. A block key is created, the resource is uploaded and the link with its url is created. create_web_resource(web_source, url, type, raw_object, lang = NULL, =..) web_source url type raw_object lang The name of the web source where the url and object will be included. All www resource links and urls are grouped under a "web source" which is just a name to allow removing them with a single call. The url that will be used by the server to return the resource with a GET call. These urls cannot start with the name of an existing source or the API will try to execute them as API calls. The mime type of the resource. A constant in type_const should be used rather than the corresponding integer value. The object to be uploaded via an http PUT call. Interpret "raw" as in "as is". Most cases will be strings, some R raw objects for binary PUT are also possible. The http language definition for the resource in case it has to be defined. Default value is not defined. Valid strings are: "en-us", "es-es",.. or just two letters as in "jp". (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). This function returns the newly created key value for further use or throws an error on failure.

8 delete_block set_jazz_('127.0.0.1:8888') page <- '<html>\n<body>\n<br/>hello world!\n</body>\n</html>' create_web_resource('my_test', '/my_test/hello.html', type_const[['blocktype_raw_mime_html']], page) # See http://127.0.0.1:8888/my_test/hello.html with a browser. list_web_sources() delete_web_source('my_test') delete_block Delete a block on the server Deletes a block on the server. You must own the block to be able to delete it. It is the lowest level function and it can create harm on the server to delete blocks belonging to meshes or API functions. delete_block(source, block_key, =.., silent = FALSE) source block_key silent The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). (Optional) If this is TRUE, the function returns FALSE instead of throwing an error in case the corresponding PUT or DELETE function returns false. Returns TRUE if successful. When silent == FALSE (default) throws an error on any failure. Otherwise, it returns FALSE when the corresponding PUT or DELETE function returns false.

delete_source 9 create_source('demo_bin') # When a string is written into a raw block, chartoraw() is applied automatically. put_raw_block('demo_bin', 'blk_1', 'Hello world!') a <- get_raw_block('demo_bin', 'blk_1') # a is raw rawtochar(a) # This is the same. put_raw_block('demo_bin', 'blk_2', chartoraw('hello again!')) rawtochar(get_raw_block('demo_bin', 'blk_2')) # Anything else can be written by serializing as raw. put_raw_block('demo_bin', 'blk_3', serialize(iris, NULL)) head(unserialize(get_raw_block('demo_bin', 'blk_3'))) # Delete the block or fail delete_block('demo_bin', 'blk_1') # Delete will fail, but make it silent delete_block('demo_bin', 'blk_1', silent = TRUE) # No need to delete all blocks, they will be deleted by deleting the source. delete_source('demo_bin') delete_source Delete a source on the server Deletes a source on the server even if it is not empty. The sources sys and www cannot be deleted. delete_source(source, =.., silent = FALSE) source The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore.

10 delete_web_source silent (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). (Optional) If this is TRUE, the function returns FALSE instead of throwing an error in case the corresponding PUT or DELETE function returns false. Returns TRUE if successful. When silent == FALSE (default) throws an error on any failure. Otherwise, it returns FALSE when the corresponding PUT or DELETE function returns false. create_source('demo_put') create_block_rep('demo_put', 'bool_1', TRUE, 3) any(rep(true, 3)!= get_r_block('demo_put', 'bool_1')) create_block_rep('demo_put', 'int_1', 2L, 4) any(rep(2l, 4)!= get_r_block('demo_put', 'int_1')) create_block_rep('demo_put', 'real_1', 3.14, 5) any(rep(3.14, 5)!= get_r_block('demo_put', 'real_1')) create_block_rep('demo_put', 'str_1', 'Hi!', 6) any(rep('hi!', 6)!= get_r_block('demo_put', 'str_1')) create_block_seq('demo_put', 'int_2', 456L, 999L, 123L) any(seq(456l, 999L, 123L)!= get_r_block('demo_put', 'int_2')) create_block_seq('demo_put', 'real_2', 0.123, 4.56, 0.789) any(seq(0.123, 4.56, 0.789)!= get_r_block('demo_put', 'real_2')) delete_source('demo_put') delete_web_source Remove a complete web source for the server s "www" source Removes a complete web source for the server s "www" source. This also deletes all the resources allocated with the web source. delete_web_source(web_source, =.., silent = FALSE)

get_block_as_string 11 web_source silent The name of the web source to be deleted. All www resource links and urls are grouped under a "web source" which is just a name to allow removing them with a single call. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). (Optional) If this is TRUE, the function returns FALSE instead of throwing an error in case the corresponding PUT or DELETE function returns false. Details This is a macro function wrapping calls around put_function(). Returns TRUE if successful. When silent == FALSE (default) throws an error on any failure. Otherwise, it returns FALSE when the corresponding PUT or DELETE function returns false. set_jazz_('127.0.0.1:8888') page <- '<html>\n<body>\n<br/>hello world!\n</body>\n</html>' create_web_resource('my_test', '/my_test/hello.html', type_const[['blocktype_raw_mime_html']], page) # See http://127.0.0.1:8888/my_test/hello.html with a browser. list_web_sources() delete_web_source('my_test') get_block_as_string Get a data block as an R string Converts a data block into an R string with an sprintf compatible format string controlling the precise output format. get_block_as_string(source, block_key, fmt, =..)

12 get_block_as_string source block_key fmt The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The (sprintf() compatible) format to convert the data as strings. Note: Newlines are NOT added automatically, use \n to add a newline where necessary. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). The output string or raises an error on failure. create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1') # The attribute flags is writable by the user. put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6) # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type.

get_block_attributes 13 set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2') # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3')) delete_source('demo_types') get_block_attributes Get the (header) attributes of a block Gets the following attributes of a block: type, length, size, flags and hash64 as an R list. get_block_attributes(source, block_key, =..) source block_key The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). An R list with the attributes: type, length, size, flags and hash64 or raises an error on failure.

14 get_block_attributes create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1') # The attribute flags is writable by the user. put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6) # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type. set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2') # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3'))

get_raw_block 15 delete_source('demo_types') get_raw_block Generic (low level) GET call to a block in the block API Writes data from a block persisted in the server. get_raw_block(source, block_key, =.., buffsize = 1048576) source block_key buffsize The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). (Default = 1 Mb) the size of the buffer to download binary objects. Must be bigger or equal to the size of the block downloaded. An R raw object or throws an exception on failure. create_source('demo_bin') # When a string is written into a raw block, chartoraw() is applied automatically. put_raw_block('demo_bin', 'blk_1', 'Hello world!') a <- get_raw_block('demo_bin', 'blk_1') # a is raw rawtochar(a) # This is the same. put_raw_block('demo_bin', 'blk_2', chartoraw('hello again!')) rawtochar(get_raw_block('demo_bin', 'blk_2'))

16 get_r_block # Anything else can be written by serializing as raw. put_raw_block('demo_bin', 'blk_3', serialize(iris, NULL)) head(unserialize(get_raw_block('demo_bin', 'blk_3'))) # Delete the block or fail delete_block('demo_bin', 'blk_1') # Delete will fail, but make it silent delete_block('demo_bin', 'blk_1', silent = TRUE) # No need to delete all blocks, they will be deleted by deleting the source. delete_source('demo_bin') get_r_block Read a data block as an R object Reads a data block as an R object. The server automatically converts the appropriate data type into logical, integer, numeric or character. get_r_block(source, block_key, =.., buffsize = 1048576) source block_key buffsize The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). (Default = 1 Mb) the size of the buffer to download binary objects. Must be bigger or equal to the size of the block downloaded. Returns an R object of type logical, integer, numeric or character or raises an error on failure.

get_server_version 17 create_source('demo_put') create_block_rep('demo_put', 'bool_1', TRUE, 3) any(rep(true, 3)!= get_r_block('demo_put', 'bool_1')) create_block_rep('demo_put', 'int_1', 2L, 4) any(rep(2l, 4)!= get_r_block('demo_put', 'int_1')) create_block_rep('demo_put', 'real_1', 3.14, 5) any(rep(3.14, 5)!= get_r_block('demo_put', 'real_1')) create_block_rep('demo_put', 'str_1', 'Hi!', 6) any(rep('hi!', 6)!= get_r_block('demo_put', 'str_1')) create_block_seq('demo_put', 'int_2', 456L, 999L, 123L) any(seq(456l, 999L, 123L)!= get_r_block('demo_put', 'int_2')) create_block_seq('demo_put', 'real_2', 0.123, 4.56, 0.789) any(seq(0.123, 4.56, 0.789)!= get_r_block('demo_put', 'real_2')) delete_source('demo_put') get_server_version Get the version of the Jazz server Returns the version of the Jazz server and throws a warning if it does not match the (major version, minor version) of the R client. get_server_version( =.., full = FALSE) full (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). Returns a list of server properties, including: version, build (DEBUG or RE- LEASE), artifact (name of the OS where it was built), myname (node name in Jazz), sysname (Linux), name (name of the running ), kernel (linux kernel), sysvers (detailed build of the OS), machine (processor type and size of the pointers).

18 list_sources Returns the version of the Jazz server when full = FALSE or a list of server properties if TRUE. Throws an error on failure and a warning if it does not match the (major version, minor version) of the R client. get_server_version() get_server_version(full=t) license BBVA - Jazz: A lightweight analytical web server for data-driven applications - R client. Copyright 2016-2017 Banco Bilbao Vizcaya Argentaria, S.A. This product includes software developed at BBVA (https://www.bbva.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/license-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. list_sources List all the sources on the Jazz server Lists all the Jazz server sources including the sys and www sources. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. list_sources( =..)

list_web_sources 19 (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). Returns the server s sources as a vector of string. list_sources() list_web_sources List all the web sources on the Jazz server Lists all the web sources on the Jazz server. All www resource links and urls are grouped under a "web source" which is just a name to allow removing them with a single call. list_web_sources( =..) (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). Returns the web sources as a vector of string. set_jazz_('127.0.0.1:8888') page <- '<html>\n<body>\n<br/>hello world!\n</body>\n</html>' create_web_resource('my_test', '/my_test/hello.html', type_const[['blocktype_raw_mime_html']], page) # See http://127.0.0.1:8888/my_test/hello.html with a browser. list_web_sources() delete_web_source('my_test')

20 notice new_key Create a key for a new block using a RNG Creates a key for a new block using a RNG. The function uses runif() and does not perform any seed initialization. See.Random.seed for more information on R s random number generation algorithms. new_key( =..) (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). This function returns the newly created key value for further use. new_key() new_key() new_key() notice BBVA - Jazz: A lightweight analytical web server for data-driven applications - R client. Copyright 2016-2017 Banco Bilbao Vizcaya Argentaria, S.A. This product includes software developed at BBVA (https://www.bbva.com/)

put_block_flags 21 put_block_flags Write flags into a block s header Writes a 32 bit integer named flags into a block s header. The server does not use that value in the block API. put_block_flags(source, block_key, flags, =..) source block_key flags The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The (integer) value written into the block s header as the flags attribute. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1') # The attribute flags is writable by the user.

22 put_raw_block put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6) # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type. set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2') # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3')) delete_source('demo_types') put_raw_block Write a raw object or a string as a block. Writes a raw object or a string as a block in persistence. That block can be stored as raw, converted to a compatible raw type or converted into data by the server. put_raw_block(source, block_key, block_val, =..)

put_raw_block 23 source block_key block_val The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The content of the block. This function is for data blocks and the type is automatic. The block must be an array of: boolean, integer, double or string. For blocks other than data blocks, such as web resources, use the appropriate function. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_bin') # When a string is written into a raw block, chartoraw() is applied automatically. put_raw_block('demo_bin', 'blk_1', 'Hello world!') a <- get_raw_block('demo_bin', 'blk_1') # a is raw rawtochar(a) # This is the same. put_raw_block('demo_bin', 'blk_2', chartoraw('hello again!')) rawtochar(get_raw_block('demo_bin', 'blk_2')) # Anything else can be written by serializing as raw. put_raw_block('demo_bin', 'blk_3', serialize(iris, NULL)) head(unserialize(get_raw_block('demo_bin', 'blk_3'))) # Delete the block or fail delete_block('demo_bin', 'blk_1') # Delete will fail, but make it silent delete_block('demo_bin', 'blk_1', silent = TRUE) # No need to delete all blocks, they will be deleted by deleting the source. delete_source('demo_bin')

24 put_r_block put_r_block Write an R object as a data block Writes an R object as a data block of type BLOCKTYPE_C_BOOL, BLOCKTYPE_C_OFFS_CHARS, BLOCKTYPE_C_R_INTEGER or BLOCKTYPE_C_R_REAL for R objects of type logical, character, integer or numeric. put_r_block(source, block_key, sexp, =..) source block_key sexp The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The R object written into the block. Must be logical, character, integer or numeric. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1')

put_strings_as_block 25 # The attribute flags is writable by the user. put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6) # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type. set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2') # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3')) delete_source('demo_types') put_strings_as_block Write a vector of strings as a data block Writes a data block by converting a vector of strings into a vector of the appropriate type. put_strings_as_block(source, block_key, txt, type, fmt = NA, =..)

26 put_strings_as_block source block_key txt type fmt The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore. The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. A single string with the rows separated by \n or a vector of strings. The latter will be converted into the former automatically. The block will initially be a block of strings and then be converted into a binary block. The destination type. Possible formats are: BLOCKTYPE_C_BOOL..BLOCKTYPE_C_R_REAL. (Optional) The (sscanf() compatible) format to convert the strings to binary data. Note: Each input line produces one data element row by row. Newline is not part of fmt. By default, this is set automatically to the simplest format for the type assuming strings do not contain any other characters than the decimal representation of the numbers. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises and error on failure. create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1') # The attribute flags is writable by the user. put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6)

set_compatible_data_type 27 # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type. set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2') # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3')) delete_source('demo_types') set_compatible_data_type Change the type of a data block to a binary compatible type Changes the type of a data block to a binary compatible type without changing its contents. This is only valid between integer types (integer, sorted and categorical) and real types (double and time). This can also be used to change within raw types. set_compatible_data_type(source, block_key, type, =..) source The Jazz source. Jazz persistence is organized in sources. All sources except sys and www are user defined. Sources are 15 char long alphanumeric or underscore.

28 set_compatible_data_type block_key type The key identifying the block. Keys are 15 alphanumeric or underscore characters. They can be user defined or created by new_key(). Also, meshes use block keys internally. The new type of the block. Must be binary compatible with the exiting type. BLOCKTYPE_C_INTEGER to BLOCKTYPE_C_FACTOR or BLOCKTYPE_C_GRADE and BLOCKTYPE_C_REAL to BLOCKTYPE_C_TIMESEC. (Optional) the name of the jazz server (including the port). Usually set just once via set_jazz_(). TRUE or raises an error on failure. create_source('demo_types') # Write a text file as a block. txt <- c('hi all,', '', 'This is a file.', '', 'bye,', 'me') str <- paste(txt, collapse = '\n') cat(str) put_raw_block('demo_types', 'blk_1', str) # The block is raw (not interpreted as data by the server) and can be converted to any raw type. set_compatible_data_type('demo_types', 'blk_1', type_const[['blocktype_raw_mime_txt']]) # curl 127.0.0.1:8888//demo_types.blk_1 (or open in a in a browser) get_block_attributes('demo_types', 'blk_1') # The attribute flags is writable by the user. put_block_flags('demo_types', 'blk_1', 123000444) get_block_attributes('demo_types', 'blk_1') # Unlike the previous block, this block is a data block. put_r_block('demo_types', 'blk_2', 3:6) # This trivial block can also be created by the server as.. create_block_seq('demo_types', 'blk_2', 3L, 6) get_block_attributes('demo_types', 'blk_2') # The block is interpreted as data by the server, it is an integer and can be converted to any integer type. set_compatible_data_type('demo_types', 'blk_2', type_const[['blocktype_c_r_grade']]) get_block_attributes('demo_types', 'blk_2')

set_jazz_ 29 # This returns all the rows in a single string get_block_as_string('demo_types', 'blk_2', ' # With some help of R functions, the result of get_block_as_string() can be made integer again. any(3:6!= as.integer(strsplit(get_block_as_string('demo_types', 'blk_2', ' rs <- c('1', '2.7', '3.14') # Creating strings into numeric data. (The parse(.., collapse = '\n') is automatic.) put_strings_as_block('demo_types', 'blk_3', rs, type_const[['blocktype_c_r_real']]) get_block_attributes('demo_types', 'blk_3') any(as.numeric(rs)!= get_r_block('demo_types', 'blk_3')) delete_source('demo_types') set_jazz_ Set the name of the Jazz server to avoid passing it in all function calls Sets the name of the Jazz server to avoid passing it in all function calls. It simply assigns it to the global variable.. set_jazz_() The name of the jazz server (including the port). Returns TRUE if the argument is a single string. No other checks done. set_jazz_('127.0.0.1:8888') page <- '<html>\n<body>\n<br/>hello world!\n</body>\n</html>' create_web_resource('my_test', '/my_test/hello.html', type_const[['blocktype_raw_mime_html']], page) # See http://127.0.0.1:8888/my_test/hello.html with a browser.

30 type_const list_web_sources() delete_web_source('my_test') type_const A set of server constants stored in a list This is a global variable of type list that contains a set of constants used in the Jazz API. All constants are integers. Direct usage of the integer values is possible but not recommended. type_const[['blocktype_raw_mime_html']]

Index create_block_rep, 3 create_block_seq, 4 create_error_page, 5 create_source, 6 create_web_resource, 7 delete_block, 8 delete_source, 9 delete_web_source, 10 get_block_as_string, 11 get_block_attributes, 13 get_r_block, 16 get_raw_block, 15 get_server_version, 17 license, 18 list_sources, 18 list_web_sources, 19 new_key, 20 notice, 20 put_block_flags, 21 put_r_block, 24 put_raw_block, 22 put_strings_as_block, 25 rjazz (rjazz-package), 2 rjazz-package, 2 set_compatible_data_type, 27 set_jazz_, 29 type_const, 30 31