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.eval — Method
engee.genie.eval(code::AbstractString)
Executes the specified code in the Engee workspace outside the context of a running Genie application. Used to run individual expressions, for debugging, or to execute code dynamically without having to restart the application.
Arguments
code::AbstractString: a string containing Julia code to be executed in the Engee workspace.
Examples
engee.genie.eval("x = 5")
#
engee.genie.include — Method
Engee.Genie.include(mapexpr::Function, path::AbstractString)
Evaluates the contents of the input source file in the global scope of the containing module. Each Module (except those defined using baremodule) has a private definition of the function include with a single argument, which evaluates the file in that module for usage within that module. Returns the result of the last evaluated expression in the input file. Upon inclusion, a local path to the directory containing the file is set. Nested calls to include will search relative to this path. This function is typically used for interactive loading of source code or for combining files in packages split across multiple source files.
Arguments
-
mapexpr: an optional first argument that can be used to transform the included code before
it is evaluated: for each parsed expression expr in path, the function include effectively evaluates mapexpr(expr). If omitted, mapexpr defaults to identity.
-
path: is normalised usingnormpath, which resolves relative path elements such as..and converts/to the appropriate path separator.
|
Syntactic scoping in Julia recognises an explicit call to the literal |
|
Совместимость: Julia 1.5
Julia 1.5 is required to pass the |
#
engee.genie.list — Method
engee.genie.list()
Displays a list of all running Genie applications.
Examples
engee.genie.list()
#
engee.genie.recv — Method
engee.genie.recv(wsVarName::AbstractString; context::Module=GenieAPI)
Returns the value of a variable from the specified context (module) in the Engee workspace whilst the Genie application is running.
By default, the variable is searched for in the GenieAPI module, but if necessary, you can explicitly specify a different module using the context parameter. Thus, if the variable is defined in a different module, the context parameter is used to specify the namespace in which to search for it.
Arguments
-
wsVarName::AbstractString: the name of the variable whose value you wish to retrieve. -
context::Module=GenieAPI: the module in which the variable is searched for. This is specified explicitly if the variable does not belong to the moduleGenieAPI.
Examples
# Retrieving the value of the variable x from the module Main
engee.genie.recv("x"; Main)
# Retrieving the value of the variable a by default
engee.genie.recv("a")
# Retrieving the value of the variable value from a user module
engee.genie.recv("value"; context=MyModule)
#
engee.genie.send — Method
engee.genie.send(wsVarName::AbstractString, value::Any)
Saves the value value to the variable wsVarName in the Engee workspace whilst the Genie application is running.
If a variable with that name does not already exist, it will be created automatically. This function is useful 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 a 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 the variable x
engee.genie.send("x", 124)
# Storing a string in the variable message
engee.genie.send("message", "Hello")
#
engee.genie.start — Method
engee.genie.start(app_path::String; devel::Bool=false, log_file::String="", open_url::Bool=false)
Launches the Genie application from the specified path.
Once executed, the function returns a GenieApplicationStatus containing a link to the application (the following is also displayed: into the console as ... at 'https://.../genie/<AppName>/'). You can open the link in a new tab or window, or copy it to open it manually.
Before the engee.genie.start command is used, please ensure that, if the application is a directory, it contains a file with the application’s code and a .jl extension. Also, delete any config and *.toml files (if present).
Arguments
-
app_path::String: the path to the application directory. This can be either relative or absolute. -
devel::Bool=false: a parameter to enable 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, logs are not saved separately. -
open_url::Bool=false: iftrue, then Engee will automatically open the application’s URL in a browser (the link is also available in the returned status).
Examples
# Running Genie via the application file app.jl, without development mode and without saving logs
engee.genie.start("/user/app.jl")
# Running Genie via the application file app.jl, with development mode and saving logs
engee.genie.start("/user/app.jl", devel=true, log_file="/user/logs.txt")
# Launching and automatically opening the application in a browser
engee.genie.start("RadarCalculate", open_url=true)
#
engee.genie.stop — Method
engee.genie.stop(app_path::String)
Stops a running Genie application.
Arguments
app_path::String: the path to the application directory. Can be relative or absolute.
Examples
# Stopping the application by absolute path
engee.genie.stop("/user/app.jl")
# Stopping the application by relative path
engee.genie.stop("app.jl")