Engee documentation

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(code::AbstractString)

Executes the specified code in the Engee workspace outside the context of a running Genie application. Used to run individual expressions, debug, or dynamically execute code 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")
include([mapexpr::Function,] path::AbstractString)

Evaluate the contents of the input source file in the global scope of the containing module. Every Module (except those defined with baremodule) has a private, single-argument definition of include, which evaluates the file within that module, for use within that module. Returns the result of the last evaluated expression in the input file. During inclusion, a task-local include path is set to the directory containing the file. Nested calls to include will search relative to that path. This function is typically used to load source interactively, or to combine files in packages that are split across multiple source files. The argument path is normalised using normpath, which resolves relative path tokens such as .. and converts / to the appropriate path separator.

The optional first argument mapexpr can be used to transform the included code before it is evaluated: for each parsed expression expr in path, the include function actually evaluates mapexpr(expr). If it is omitted, mapexpr defaults to identity.

Use Base.include to evaluate a file into another module.

Julia’s syntax lowering recognises an explicit call to a literal include at top-level and inserts an implicit @Core.latestworld to make any included definitions visible to subsequent code. Note, however, that this recognition is syntactic. That is, assigning const myinclude = include may require an explicit @Core.latestworld call after myinclude.

Совместимость: Julia 1.5

Julia 1.5 is required to pass the mapexpr argument.

engee.genie.list()

Displays a list of all running Genie applications.

Examples

engee.genie.list()
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 module GenieAPI, but if necessary, you can explicitly specify a different module using the parameter context. Thus, if the variable is defined in a different module, the parameter context is used to specify the namespace in which to search for it.

Arguments

  • wsVarName::AbstractString : the name of the variable whose value is to be retrieved.

  • context::Module=GenieAPI: the module in which the variable is searched for. This is specified explicitly if the variable does not belong to the GenieAPI module.

Examples

# Retrieving the value of the variable `x` from the module `Main`
engee.genie.recv("x", Main)

# Retrieving the value of the variable `a` from the module by default
engee.genie.recv("a")

# Retrieving the value of the variable `value` from a user-defined module
engee.genie.recv("value"; context=MyModule)
engee.genie.send(wsVarName::AbstractString, value::Any)

Saves the value value to the variable wsVarName in the Engee workspace whilst the application is running on Genie.

If a variable with this name does not already exist, it will be created automatically. This function is useful for passing 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 to 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(app_path::String; devel::Bool=false, log_file::String="", open_url::Bool=false)

Launches the Genie application at the specified path.

After launching, the function returns GenieApplicationStatus, which contains a link to the application (also displayed in the console as ... at 'https://.../genie/<AppName>/'). The link can be opened in a new tab or window, or copied to open manually.

Before using the engee.genie.start command, ensure that, if the application is a directory, it contains a file with the application’s code and the .jl extension. Also, delete any config and *.toml files (if present).

Arguments

  • app_path::String : the path to the application directory. This can be 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 to specify the path to the log file. If not specified, logs are not saved separately.

  • open_url::Bool=false: if true, then Engee will automatically open the application’s URL in a browser (the link is also available in the return status).

Examples

# Running Genie via the application file app.jl, without development mode and without logging
engee.genie.start("/user/app.jl")

# Running Genie via the application file app.jl, with development mode and logging
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(app_path::String)

Stops a running Genie application.

Arguments

app_path::String: the path to the application directory. This 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")