Commit b45a0d60 authored by Ryan Berkheimer's avatar Ryan Berkheimer
Browse files

completed Dockerfile.demo setup

parent db78e801
Pipeline #5987 failed with stage
in 0 seconds
......@@ -20,6 +20,9 @@ bin/*
.devcontainer/*
*.code-workspace
#For demos
.ipynb_checkpoints/*
#for leiningen builds
.lein*
/.lein-*
......
......@@ -42,9 +42,9 @@ TEST_RESOURCE_DIR=$(PROJECT_ROOT)/libs
run-native-tests: export LD_LIBRARY_PATH = $(JAVA_HOME)/lib/jli:$(JAVA_HOME)/lib/server
run-native-tests: export CLASSPATH = $(TEST_RESOURCE_DIR)/test/java/jars/$(SRC_JAR)
.PHONY: build-c_cpp prep-java build-java dist-java run-native-tests copy-docs cleanup
.PHONY: build-c_cpp prep-java build-java dist-java run-native-tests copy-docs #cleanup
all: build-c_cpp prep-java build-java dist-java copy-docs run-native-tests cleanup
all: build-c_cpp prep-java build-java dist-java copy-docs run-native-tests #cleanup
build-c_cpp:
@echo "Building the shared library for C/C++ native sessions and the distributable native C artifacts."
......
*
!.gitignore
\ No newline at end of file
%% Cell type:code id: tags:
``` c
#include <stdio.h>
int main() {
printf("Hello world\n");
}
```
%%%% Output: stream
Hello world
%% Cell type:code id: tags:
``` c
//%cflags:-fPIC -std=c99 -I/home/messageapi/.messageapi/c/headers -I/usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64/include -I/usr/lib/jvm/java-11-openjdk-11.0.8.10-1.el7.x86_64/include/linux -L/workspaces/messageapi/libs/test/c/session/so -lmessageapi
#include <jni.h>
#include <stdio.h>
#include "messageapi_structs.h"
#include "MessageApiSessionLib.h"
int main(int argc, char **argv)
{
puts("In our native session demo test!\n");
puts("Hello, World\n");
fflush(stdout);
session *session = createSession("/workspaces/messageapi/resources/test/file-reader-native/manifest.json");
puts("Successfully created session.");
fflush(stdout);
request *request1 = createRequest(session);
puts("Successfully created a request.");
fflush(stdout);
record *record1 = createRequestRecord(session, request1);
puts("Successfully created a request record.");
fflush(stdout);
field *field1 = getField(session, record1, "file-path");
puts("Successfully retrieved the file-path field from the request record.");
fflush(stdout);
setFieldStringVal(session, field1, "/workspaces/messageapi/resources/test/inputs/file-reader/simpletextfile");
puts(getFieldStringVal(session, field1));
fflush(stdout);
puts("Successfully set the field string value for the file-path field from the request record.");
fflush(stdout);
//record_list *session_records = createRecordList(session);
//addRecord(session, session_records, record1);
//setRequestRecords(session, request1, session_records);
//record *record2 = createRequestRecord(session, request1);
//field *field2 = getField(session, record2, "file-path");
//setFieldStringVal(session, field2, "/workspaces/messageapi/resources/test/inputs/file-reader/proc_sm_gtsnp_data_ftp_CF6_cf6_20190506.txt");
record_list *request_records = getRequestRecords(session, request1);
printf("Request record count: %d\n", request_records->count);
fflush(stdout);
response *response = submitRequest(session, request1);
puts("Response completion status right after submission:");
fputs(isComplete(session, response) ? "true" : "false", stdout);
puts("");
fflush(stdout);
puts("Successfully submitted the request.");
fflush(stdout);
puts(getFieldStringVal(session, field1));
fflush(stdout);
while (!isComplete(session, response)) {}
puts("Successfully returned from the request.");
fflush(stdout);
//puts(getFieldStringVal(session, field1));
//fflush(stdout);
record_list *response_records = getResponseRecords(session, response);
rejection_list *response_rejections = getResponseRejections(session, response);
printf("Record count: %d\n", response_records->count);
printf("Rejection count: %d\n", response_rejections->count);
fflush(stdout);
releaseSession(session);
return 0;
}
```
%%%% Output: stream
In our native session demo test!
Hello, World
Successfully created session.
Successfully created a request.
Successfully created a request record.
Successfully retrieved the file-path field from the request record.
/workspaces/messageapi/resources/test/inputs/file-reader/simpletextfile
Successfully set the field string value for the file-path field from the request record.
Request record count: 1
Response completion status right after submission:
false
Successfully submitted the request.
/workspaces/messageapi/resources/test/inputs/file-reader/simpletextfile
Successfully returned from the request.
Record count: 7
Rejection count: 0
%% Cell type:code id: tags:
``` c
```
%% Cell type:code id: tags:
``` java
List<String> added = %jars /workspaces/messageapi/build/libs/messageapi-core-1.0.0.jar
```
%% Cell type:code id: tags:
``` java
import gov.noaa.messageapi.interfaces.ISession;
```
%% Cell type:code id: tags:
``` java
import gov.noaa.messageapi.sessions.StandardSession;
```
%% Cell type:code id: tags:
``` java
ISession session = new StandardSession("/workspaces/messageapi/resources/test/native-condition/parameters.json");
```
%% Cell type:code id: tags:
``` java
import gov.noaa.messageapi.interfaces.*;
```
%% Cell type:code id: tags:
``` java
IRequest request = session.createRequest()
```
%% Cell type:code id: tags:
``` java
IRecord record = request.createRecord();
IRecord record2 = request.createRecord();
```
%% Cell type:code id: tags:
``` java
record.setField("int-field", 1);
record2.setField("int-field", 100);
```
%% Cell type:code id: tags:
``` java
record.getField("int-field").getValue()
```
%%%% Output: execute_result
1
%% Cell type:code id: tags:
``` java
IResponse response = request.submit()
```
%% Cell type:code id: tags:
``` java
response.isComplete()
```
%%%% Output: execute_result
true
%% Cell type:code id: tags:
``` java
response.getRecords().size()
```
%%%% Output: execute_result
3
%% Cell type:code id: tags:
``` java
response.getRecords().forEach(r -> r.getFields().forEach(f->System.out.println(f.getId() + ", " + f.getValue())))
```
%%%% Output: stream
int-field, 100
int-field, 1
int-field, 100
%% Cell type:code id: tags:
``` java
IResponse response2 = request.submit()
```
%% Cell type:code id: tags:
``` java
response2.isComplete()
```
%%%% Output: execute_result
true
%% Cell type:code id: tags:
``` java
response2.getRecords().size()
```
%%%% Output: execute_result
3
%% Cell type:code id: tags:
``` java
record.getField("int-field").getValue()
```
%%%% Output: execute_result
1
%% Cell type:code id: tags:
``` java
record.getFields()
```
%%%% Output: execute_result
[gov.noaa.messageapi.fields.DefaultField@18fc3f5f]
%% Cell type:code id: tags:
``` java
record.getFields().forEach(f->System.out.println(f.getId() + ", " + f.getValue()))
```
%%%% Output: stream
int-field, 1
%% Cell type:code id: tags:
``` java
response.getRecords().size()
```
%%%% Output: execute_result
3
%% Cell type:code id: tags:
``` java
response.getRejections().size()
```
%%%% Output: execute_result
0
%% Cell type:code id: tags:
``` java
response2.getRejections().size()
```
%%%% Output: execute_result
0
%% Cell type:code id: tags:
``` java
ISession fileReaderSession = new StandardSession("/workspaces/messageapi/resources/test/file-reader/parameter_map_style.json")
```
%% Cell type:code id: tags:
``` java
IRequest fileReaderRequest = fileReaderSession.createRequest();
```
%% Cell type:code id: tags:
``` java
IRecord record = fileReaderRequest.createRecord();
```
%% Cell type:code id: tags:
``` java
record.getFields().forEach(f->System.out.println(f.getId() + ", " + f.getValue()))
```
%%%% Output: stream
file-path, null
%% Cell type:code id: tags:
``` java
record.setField("file-path", "/workspaces/messageapi/build/resources/test/inputs/file-reader/proc_sm_gtsnp_data_ftp_CF6_cf6_20190506.txt");
```
%% Cell type:code id: tags:
``` java
IResponse fileReaderResponse = fileReaderRequest.submit();
fileReaderResponse.isComplete();
```
%%%% Output: execute_result
false
%% Cell type:code id: tags:
``` java
fileReaderResponse.isComplete();
```
%%%% Output: execute_result
false
%% Cell type:code id: tags:
``` java
fileReaderResponse.getRecords().size();
```
%%%% Output: execute_result
79794
%% Cell type:code id: tags:
``` java
fileReaderResponse.getRecords().get(100);
```
%%%% Output: execute_result
gov.noaa.messageapi.records.schema.SchemaRecord@3881fdaf
%% Cell type:code id: tags:
``` java
fileReaderResponse.getRecords().get(100).getFields().forEach(f -> System.out.println(f.getId() + ", " + f.getValue()))
```
%%%% Output: stream
value, # LAST OF SEVERAL OCCURRENCES
length, 29
number, 100
%% Cell type:code id: tags:
``` java
fileReaderResponse.getRecords().get(99).getField("value").getValue()
```
%%%% Output: execute_result
NOTES:
%% Cell type:code id: tags:
``` java
import java.util.List;
```
%% Cell type:code id: tags:
``` java
```
......@@ -8,7 +8,7 @@ FROM registry.access.redhat.com/ubi7/ubi:latest
#Install standard RHEL7 tools
RUN yum -y install --disableplugin=subscription-manager \
vim wget git java-11-openjdk-devel gcc gcc-gfortran gcc-c++ make \
vim wget git java-11-openjdk-devel gcc gcc-gfortran gcc-c++ make unzip \
&& yum --disableplugin=subscription-manager clean all
#Install Java Variables
......@@ -35,6 +35,17 @@ RUN /bin/bash miniconda.sh -b -p ${workdir}/miniconda
#Install Jupyter Notebook via Conda
RUN cd ${workdir}/miniconda/bin && ./conda install -y jupyter
#Install the Java Kernel
RUN wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip -O ijava.zip
RUN unzip ijava.zip
RUN ${workdir}/miniconda/bin/python install.py --sys-prefix
#Install the C Kernel
RUN git clone https://github.com/brendan-rius/jupyter-c-kernel.git
RUN ${workdir}/miniconda/bin/pip install --no-cache-dir jupyter-c-kernel/
RUN cd ${workdir}/jupyter-c-kernel/jupyter_c_kernel && ${workdir}/miniconda/bin/python install_c_kernel --user
RUN cp -r ${workdir}/jupyter-c-kernel/jupyter_c_kernel/resources ${workdir}/miniconda/lib/python3.8/site-packages
#Retrieve the installation script to the user's home directory and set permissions for execution
RUN wget https://k3.cicsnc.org/rberkheimer/messageapi/-/raw/mac-develop/scripts/install/package/install_k3.sh?inline=false \
--no-check-certificate -O install_k3.sh
......
......@@ -31,7 +31,7 @@
],
"endpoints": [
{
"plugin": "gov.noaa.messageapi.EvaluationEndpoint",
"plugin": "gov.noaa.messageapi.endpoints.EvaluationEndpoint",
"connections": [{
"id": "conn-1",
"constructor": {},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment