SMO: No model built yet - machine-learning

I am able to create a model in MOA(Weka) for case 1 but not for "case 2" (same data set). Could anyone explain why?
Case 1 (IBk/LWL):
java -cp moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "LearnModel -l (meta.WEKAClassifier -l (weka.classifiers.lazy.IBk)) -s (ArffFileStream -f training_s2w.arff -c 1) -O model.moa"
java -cp moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "EvaluateModel -m file:model.moa -s (ArffFileStream -f test_s2w.arff -c 1) -o predicted.txt"
Above two commands creates a model and apply it on test data successfully.
Case 2 (SMO/J48/NaiveBayes/BayesNet):
java -cp moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "LearnModel -l (meta.WEKAClassifier -l (weka.classifiers.functions.SMO)) -s (ArffFileStream -f training_s2w.arff -c 1) -O model.moa"
java -cp moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "EvaluateModel -m file:model.moa -s (ArffFileStream -f test_s2w.arff -c 1) -o predicted.txt"
But these two commands gives output as:
"Model description:
SMO: No model built yet"
(I checked through Weka CLI that both training and test data is Weka compatible.)
What could be the possible reason(s)?

Related

Percentage sign is not working for curl in jenkins pipeline

I have below code in my jenkins pipline
def code = bat(returnStdout: true, script: 'curl -s -o /dev/null http://www.example.org/ -w "\\n STATUS:%{http_code}"')
but when jenkins run this code it is evaluated it as
curl -s -o /dev/null http://www.example.org/ -w "\n STATUS:{http_code}"
Here you can see that it is excluding % and hence it is giving me the error
I tried to escape this % using % or % but it is not working

how to execute several commands in a running temporary container

I want to run a temporary docker and execute several command in it:
.PHONY : Test
Test:
#echo Starting Docker container
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -b '$(PRJ_BUILD_TREE)' -w '$(PRJ_WORK_DIR)' --objdir '' -c 'rm -rf build_results; \
make clean_brutal; \
$(PRJ_MISRA_CMD)/cov-build --dir build_results --encoding UTF-8 make SUB_PRODUCT=$(SUB_PRODUCT); \
$(if $(COVERITY_MISRA_2012), \
$(PRJ_test_CMD)/cov-analyze --dir build_results --disable-default --coding-standard-config /home/XX/XX-linux64-2018.06/config/coding-standards/XX/XX-all.config --paths 100000 --tu-pattern "file('.*\.c$\')"; \
$(PRJ_test_CMD)/cov-format-errors --dir build_results --html-output build_results/results/HTML_2012, );'
but I het the following error:
Illegal character in pattern: .
[ERROR] No results found.
I want to know how to run command seperately in a running container?
like:
.PHONY : Test
Test:
#echo Starting Docker container
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -b '$(PRJ_BUILD_TREE)' -w '$(PRJ_WORK_DIR)' --objdir '' -c 'rm -rf build_results; \
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -c 'make clean_brutal';
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -c '$(PRJ_MISRA_CMD)/cov-build --dir build_results --encoding UTF-8 make SUB_PRODUCT=$(SUB_PRODUCT)'
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -c '$(if $(FFFF), \
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run $(PRJ_test_CMD)/cov-analyze --dir build_results --disable-default --coding-standard-config /home/XX/XX-linux64-2018.06/config/coding-standards/XX/XX-all.config --paths 100000 --tu-pattern "file('.*\.c$\')"'
/home/pagl_home/bin/SI.docker_17cy/bin/pagl-build-env run -c '$(PRJ_test_CMD)/cov-format-errors --dir build_results --html-output'build_results/results/HTML_2012, );'
I know this doesn't work but to give an idea what I want to do

How is Maven ignoring -Xmx set through MAVEN_OPTS in openjdk:8-jdk-alpine?

I can't for the life of me figure out why -Xmx in MAVEN_OPTS doesn't work for Maven in openjdk:8-jdk-alpine.
This:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'apk add maven && MAVEN_OPTS=-Xmx2g\ -Xms2g mvn --version'
Produces:
Error occurred during initialization of VM
Initial heap size set to a larger value than the maximum heap size
I've used -XX:+PrintFlagsFinal to look at MaxHeapSize with various settings and here's what I found:
Apparently -Xmx is fixed to 512mb regardless of what's specified. Other options such as -Xms and -XX:+PrintFlagsFinal work as expected:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'apk add maven && \
MAVEN_OPTS="-Xmx123m -Xms123m -XX:+PrintFlagsFinal" mvn --version | egrep "(Initial|Max)HeapSize"'
uintx InitialHeapSize := 130023424 {product}
uintx MaxHeapSize := 536870912 {product}
apt add maven is installing maven version 3.6.0-r0 but trying with other versions also produce the same result. For example, 3.6.1-r0 in Alpine 3.10 and 3.5.2-r0 in Alpine 3.7 produced the same result:
$ docker run openjdk:8-jdk-alpine sh -c 'sed -e s:/v3.9/:/v3.10/: /etc/apk/repositories -i && \
apk add maven && MAVEN_OPTS=-Xmx2g\ -XX:+PrintFlagsFinal mvn -version | fgrep MaxHeapSize'
I've looked for ~/.m2/settings.xml and ./.mvn as mentioned in https://maven.apache.org/configure.html but neither seem to exist:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'apk add maven && ls ~/.m2'
java seems to support -Xmx fine:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'java -Xmx2g -XX:+PrintFlagsFinal -version | fgrep MaxHeapSize'
The problem doesn't occur if maven:3.6.0-jdk-8-alpine is used instead of openjdk:8-jdk-alpine:
$ docker run --rm maven:3.6.0-jdk-8-alpine sh -c \
'MAVEN_OPTS=-Xmx2g\ -XX:+PrintFlagsFinal mvn --version | fgrep MaxHeapSize'
Using _JAVA_OPTIONS instead of MAVEN_OPTS works as a workaround:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'apk add maven && \
_JAVA_OPTIONS=-Xmx2g\ -XX:+PrintFlagsFinal mvn --version | fgrep MaxHeapSize'
Question is, how is -Xmx in MAVEN_OPTS being ignored for Maven in openjdk:8-jdk-alpine?
This obscure problem is documented in this equally hard to find bug report. Basically, Maven on Alpine Linux is packaged with an /etc/mavenrc file containing these lines:
M2_HOME="$m2_home"
MAVEN_OPTS="\$MAVEN_OPTS -Xmx512m"
The problem lies in the second line which hard codes -Xmx to 512m. So yes, -Xmx cannot be set through MAVEN_OPTS on Alpine Linux's vanilla Maven as of time of writing.
To test, simply remove the file and try again:
$ docker run --rm openjdk:8-jdk-alpine sh -c 'apk add maven && rm /etc/mavenrc && \
MAVEN_OPTS=-Xmx2g\ -XX:+PrintFlagsFinal mvn --version | fgrep MaxHeapSize'
MaxHeapSize should then be set to the desired 2g.
The bug report is three years old and probably hasn't gained more traction because there's couple of conditions that need satisfying: Using Maven on Alpine Linux and requiring more than 512m to build.
A person who stumbles on this has few options:
Use _JAVA_OPTIONS instead of MAVEN_OPTS for setting -Xmx
Remove the second line of /etc/mavenrc
Hopefully for them, an OOM error will come quickly and painlessly, instead of extremely slow builds due to excessive GC'ing.

Run execlineb when container start failed. Docker for windosw

I'm trying to run simple script inside docker container after start. Initialy previous developer decided to use s6 inside.
#!/usr/bin/execlineb -P
foreground { sleep 2 }
nginx
When i'm trying to start i'm gettings this message
execlineb: usage: execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W ] [ -c commandline ] script args
Looks like something wrong with executing this scripts or with execline.
I'm using docker for windows under windows10, however if somebody else trying to build this container in ubuntu(or any othe linux) evething is ok.
Can anybody help with this kind of problem?
DockerImage: simple alpine
According to our research of this "HUGE" problem we found two ways to solve it. Definitely it's a problem with special symbols, like '\r'
Option 1 dostounix:
install dostounix in your container(in docker file)
RUN apk --no-cache add \
dos2unix \
run it againts your sh script.
RUN for file in {PathToYourFiles}; do \
dos2unix $file; \
chmod a+xwr $file; \
done
enjoy your scripts.
Option 2 VsCode(or any textEditor):
Change CRLF 'End Of Line Sequence' to LF
VS Code bottom panel
Line endings options
enjoy your scripts.

Building riot/helloworld with Docker

This is my setup:
docker pull riot/riotbuild
wget https://github.com/RIOT-OS/RIOT/archive/2019.04.zip
unzip 2019.04.zip
cd RIOT-2019.04/examples/hello-world/
make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery all
All of this is OK.
make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery flash
This step failed. Error is :
> Building application "hello-world" for "stm32f4discovery" with MCU
> "stm32f4". "make" -C /data/riotbuild/riotbase/boards/stm32f4discovery
> "make" -C /data/riotbuild/riotbase/core "make" -C
> /data/riotbuild/riotbase/cpu/stm32f4 "make" -C
> /data/riotbuild/riotbase/cpu/cortexm_common "make" -C
> /data/riotbuild/riotbase/cpu/cortexm_common/periph "make" -C
> /data/riotbuild/riotbase/cpu/stm32_common "make" -C
> /data/riotbuild/riotbase/cpu/stm32_common/periph "make" -C
> /data/riotbuild/riotbase/cpu/stm32f4/periph "make" -C
> /data/riotbuild/riotbase/drivers "make" -C
> /data/riotbuild/riotbase/drivers/periph_common "make" -C
> /data/riotbuild/riotbase/sys "make" -C
> /data/riotbuild/riotbase/sys/auto_init "make" -C
> /data/riotbuild/riotbase/sys/isrpipe "make" -C
> /data/riotbuild/riotbase/sys/newlib_syscalls_default "make" -C
> /data/riotbuild/riotbase/sys/pm_layered "make" -C
> /data/riotbuild/riotbase/sys/stdio_uart "make" -C
> /data/riotbuild/riotbase/sys/tsrb text data bss dec
> hex filename 8756 140 2620 11516 2cfc
> /data/riotbuild/riotbase/examples/hello-world/bin/stm32f4discovery/hello-world.elf
> /home/huaxing/oproj/riot/RIOT-2019.04/dist/tools/openocd/openocd.sh
> flash
> /home/huaxing/oproj/riot/RIOT-2019.04/examples/hello-world/bin/stm32f4discovery/hello-world.elf
> Flashing Target sh: 1: openocd: not found
> /home/huaxing/oproj/riot/RIOT-2019.04/examples/hello-world/../../Makefile.include:538:
> recipe for target 'flash' failed make: *** [flash] Error 127
I check the script, in fact it will finally call docker as next:
a) make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery all
docker run --rm -t -u "$(id -u)" \
-v '/usr/share/zoneinfo/PRC:/etc/localtime:ro' -v '/home/shubuntu1/g/RIOT-2019.04:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase/examples/hello-world' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' \
-e 'BOARD=stm32f4discovery' \
-w '/data/riotbuild/riotbase/examples/hello-world/' \
'riot/riotbuild:latest' make all 'BOARD=stm32f4discovery'
b) make BUILD_IN_DOCKER=1 BOARD=stm32f4discovery flash
docker run --rm -t -u "$(id -u)" \
-v '/usr/share/zoneinfo/PRC:/etc/localtime:ro' -v '/home/shubuntu1/g/RIOT-2019.04:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase/examples/hello-world' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' \
-e 'BOARD=stm32f4discovery' \
-w '/data/riotbuild/riotbase/examples/hello-world/' \
'riot/riotbuild:latest' make 'BOARD=stm32f4discovery'
They are nearly same, and the main use for container is just to build the source to stm32 binary as it's not add any permissions to control hardware when start container.
Compare to a), the b) also have next output:
### Flashing Target ###
sh: 1: openocd: not found
/home/shubuntu1/g/RIOT-2019.04/examples/hello-world/../../Makefile.include:538: recipe for target 'flash' failed
make: *** [flash] Error 127
This in fact not related to container, it runs on host, the root cause is you do not install openocd on host which used to flash the stm32 binary to device.
See this, search OpenOCD, it clear requires you to install openocd, then after the docker container finish the build, the binary will also be in host as it's in docker volume, and finally the openocd on host could flash your binary.

Resources