Connections to MIMIQ
MimiqLink.MimiqLink — Module
module MimiqLink endThis module contains convenience tools to establish and keep up a connection to the QPerfect MIMIQ services, both remote or on premises.
It allows for three different connection modes: via login page, via token, via credentials.
Login Page
This method will open a browser pointing to a login page. The user will be asked to insert username/email and password.
julia> using MimiqLink
julia> connection = MimiqLink.connect()optionally an address for the MIMIQ services can be specified
julia> connection = MimiqLink.connect(url = "http://127.0.0.1")Token
This method will allow the user to save a token file (by login via a login page), and then load it also from another julia session.
julia> using MimiqLink
julia> MimiqLink.savetoken(url = "http://127.0.0.1")this will save a token in the qperfect.json file in the current directory. In another julia session is then possible to do:
julia> using MimiqLink
julia> connection = MimiqLink.loadtoken("path/to/my/qperfect.json")Credentials
This method will allow users to access by directly use their own credentials.
It is strongly discuraged to use this method. If files with credentials will be shared the access to the qperfect account might be compromised.
julia> using MimiqLink
julia> connection = MimiqLink.connect("me@mymail.com", "myweakpassword")julia> MimiqLink.connect("me@mymail.com", "myweakpassword"; url = "http://127.0.0.1")MimiqLink.QPERFECT_CLOUD — Constant
const QPERFECT_CLOUD
Address for the QPerfect Cloud services
MimiqLink.QPERFECT_DEV — Constant
const QPERFECT_DEV
Address for secondary QPerfect Cloud services
MimiqLink.AbstractConnection — Type
abstract type AbstractConnectionAbstract type for the connection to the MIMIQ Services.
MimiqLink.Execution — Type
struct ExecutionStructure referring to an execution on the MIMIQ Services.
MimiqLink.MimiqConnection — Type
struct MimiqConnectionConnection with the MIMIQ Services.
Attributes
uri: the URI of the connected instancetokens_channel: channel updated with the latest refreshed tokenrefresher: task that refreshes the token on a configured interval
MimiqLink.PlanqkConnection — Type
PlanqkConnectionRepresents a connection to the PlanQK API.
MimiqLink.connect — Function
connect([; url=QPREFECT_CLOUD])
connect(token[; url=QPREFECT_CLOUD])
connect(username, password[; url=QPREFECT_CLOUD])
connect(PlanqkConnection, url, consumer_key, consumer_secret)
connect(PlanqkConnection)Establish a connection to the MIMIQ Services.
The first three methods return a MimiqConnection.
The last method return a PlanqkConnection effectively connecting through PlanQK.
A refresh process will be spawned in the background to refresh the access credentials. An active connection can be closed by using the close(connection) method. As an example:
connection = connect("john.doe@example.com", "johnspassword")
# connecton will be of type MimiqConnection
close(connection)The first method will open a login page in the default browser and ask for your email and password. This method is encouraged, as it will avoid saving your password as plain text in your scripts or notebooks.
There are two main servers for the MIMIQ Services: the main one and a secondary one. Users are supposed to use the main one.
julia> QPERFECT_CLOUD
URI("https://mimiq.qperfect.io")
julia> QPERFECT_DEV
URI("https://mimiqfast.qperfect.io")MimiqLink.isjobcanceled — Method
isjobcanceled(conn, execution)Check if a job has been canceled.
MimiqLink.isjobdone — Method
isjobdone(conn, execution)Check if a job is done.
Will return true if the job finished successfully or with an error and false otherwise.
MimiqLink.isjobfailed — Method
isjobfailed(conn, execution)Check if a job failed.
MimiqLink.isjobstarted — Method
isjobstarted(conn, execution)Check if a job has started executing.
MimiqLink.loadtoken — Function
loadtoken([filename])Establish a connection to the MIMIQ Services by loading the credentials from a JSON file.
Arguments
filename: file where to load the credentials (default:qperfect.json)
The credentials are usually valid only for a small amount of time, so you may need to regenerate them from time to time.
Examples
julia> savetoken("myqperfectcredentials.json")
julia> connection = loadtoken("myqperfectcredentials.json")
MimiqLink.requestinfo — Method
requestinfo(conn, req)Retrieve information about an execution request.
MimiqLink.savetoken — Function
savetoken([filename][; url=QPERFECT_CLOUD)Establish a connection to the MIMIQ Services and save the credentials in a JSON file.
Arguments
filename: file where to save the credentials (default:qperfect.json)
Keyword arguments
url: the uri of the MIMIQ Services (default:QPERFECT_CLOUDvalue)
Examples
julia> savetoken("myqperfectcredentials.json")
julia> connection = loadtoken("myqperfectcredentials.json")