Genie’s Public Software Management Methods
| An example of creating a simple application using the Genie framework is also presented in Community Engee. |
All public methods of program management are presented here. genie to work with the framework Genie. To use them in Genie applications, connect the Engee tool library using the command using Engee inside your code (app.jl).
Methods genie
#
engee.genie.start — Function
engee.genie.start(app_path::String; devel::Bool=false, log_file::String="")
Launches the Genie application using the specified path.
Before using the command engee.genie.start make sure that if the application is a directory, it contains a file with the application code and the extension.jl. Also delete the config and *.toml files (if any).
Arguments
-
app_path::String: the path to the application directory. It can be relative or absolute. -
devel::Bool=false: a parameter for enabling development mode, in which changes to the code are applied without restarting the application. -
log_file::String="": a parameter for specifying the path to the log file. If not specified, the logs are not saved separately.
Examples
# Launching Genie via the app.jl application file, without development mode and saving logs
engee.genie.start("/user/app.jl")
# Launching Genie via the app file.jl, with development mode and log saving
engee.genie.start("/user/app.jl", devel=true, log_file="/user/logs.txt")
#
engee.genie.stop — Function
engee.genie.stop(app_path::String)
Stops the running Genie app.
Arguments
app_path::String: the path to the application directory. It can be relative or absolute.
Examples
# Stopping the app on an absolute path
engee.genie.stop("/user/app.jl")
# Stopping the app by relative path
engee.genie.stop("app.jl")
#
engee.genie.list — Function
engee.genie.list()
Displays a list of all running Genie applications.
Examples
engee.genie.list()
#
engee.genie.eval — Function
engee.genie.eval(code::AbstractString)
Executes the specified code in the Engee workspace outside the context of the running Genie application. It is used to run individual expressions, debug, or dynamically execute code without having to restart the application.
Arguments
code::AbstractString: a line with Julia code that will be executed in the Engee workspace.
Examples
engee.genie.eval("x = 5")
#
engee.genie.recv — Function
engee.genie.recv(wsVarName::AbstractString; context::Module=GenieAPI )
Returns the value of a variable from the specified context (module) in the Engee workspace during the execution of the Genie application.
By default, the variable is searched in the module GenieAPI, but if necessary , you can explicitly specify another module through the parameter context. So, if the variable is defined in another module, then the parameter is used. context, indicating in which namespace to search for it.
Arguments
-
wsVarName::AbstractString: the name of the variable whose value you want to get. -
context::Module=GenieAPI: the module in which the variable is searched. It is specified explicitly if the variable does not belong to the module.GenieAPI.
Examples
# Getting the value of variable x from the Main module
engee.genie.recv("x", Main)
# Getting the value of variable a from the default module
engee.genie.recv("a")
# Getting the value of the value variable from the user module
engee.genie.recv("value"; context=MyModule)
#
engee.genie.send — Function
engee.genie.send(wsVarName::AbstractString, value::Any)
Saves the value value to a variable wsVarName in the Engee workspace while the application is running on Genie.
If a variable with this name did not exist before, it will be created automatically. The function is convenient for transferring intermediate results or user data from the Genie application to the Engee session.
Arguments
-
wsVarName::AbstractString: the name of the variable to which the value is assigned. -
value::Any: the value that will be stored in the variable. It can be of any type.
Examples
# Assigning the value 124 to variable x
engee.genie.send("x", 124)
# Saving a string in the message variable
engee.genie.send("message", "Hello")