New version v0.1.3 and a binary implementation of Julia Client
I write you to inform that version v0.1.3, with the following changes:
Logging output in console working nicely.
The script can use Logging. There are two situations:
Both situations are working nicely. For instance, for the file test_log1.jl:
using Logging, LoggingExtras
function msg()
@warn "warning 1\nanother line\nlast one"
@error "error 1"
@info "info 1"
@debug "debug 1"
end
msg()
running directly with julia:
$ julia test_log1.jl
┌ Warning: warning 1
│ another line
│ last one
└ @ Main ~/working/DaemonMode/test/test_log1.jl:4
┌ Error: error 1
└ @ Main ~/working/DaemonMode/test/test_log1.jl:5
[ Info: info 1
while in color:
running with client:
$ juliaclient test_log1.jl
Warning: warning 1
│ another line
│ last one
└ @ Main /mnt/home/daniel/working/DaemonMode/test/test_log1.jl: 4
┌ Error: error 1
└ @ Main /mnt/home/daniel/working/DaemonMode/test/test_log1.jl: 5
┌ Info: info 1
└ @ Main /mnt/home/daniel/working/DaemonMode/test/test_log1.jl: 6
┌ Debug: debug 1
└ @ Main /mnt/home/daniel/working/DaemonMode/test/test_log1.jl: 7
or in color:
Return error code (useful for scripts)
runargs() returns
- 0 if the script runs without any problem.
- 1 if there is any unexpected problem.
By example:
$ jclient hello.jl
Hello, World!
$ echo $?
0
$ jclient bad.jl
ERROR: LoadError: UndefVarError: b not defined
Stacktrace:
[1] fun2 at /mnt/home/daniel/working/DaemonMode/test/bad.jl:2
[2] fun1 at /mnt/home/daniel/working/DaemonMode/test/bad.jl:6
[3] top-level scope at /mnt/home/daniel/working/DaemonMode/test/bad.jl:9
$ echo $?
1
Binary version
julia client only send the information by sockets, so it could be implemented in any compiled language. I have used Nim for that (I first tried Rust but it is was not easy to do that, in nim it was surprising simple), and it is available in (GitHub - dmolina/juliaclient_nim: Julia client binary using DaemonMode.jl package).
You can compile it, or downloading directly the binary version (only for Linux and 64bits) at Release v0.1 · dmolina/juliaclient_nim · GitHub.
For instance, with a script that load packages CSV and DataFrame:
$ time jclient_julia test.jl 7days.csv
...
real 0m1.389s
user 0m0.489s
sys 0m0.333s
While using jclient_julia it takes only (with juliaserver loaded):
$ time jclient_julia test.jl 7days.csv
...
real 0m0.443s
user 0m0.511s
sys 0m0.292s
The half of second is due to running the julia interpreter.
Using the binary version the time is greatly reduced:
$ time jclient test.jl 7days.csv
...
real 0m0.019s
user 0m0.004s
sys 0m0.007s
To summarise, using the binary client it is faster because there is not penalty due to the load of the Julia interpreter.