Example 1: Simple annotation¶
This is a simple example to showcase the general usage of lmrtfy. It can be found
The two core concepts are the
result functions which annotate the inputs and
outputs of the script. They are needed to create the profile which is used to create the API.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- The functions need to be imported from the lmrtfy library
- The variable
xhas the local value
5and can be between 1 and 10.
- You can have numpy arrays as inputs
- Lists and dictionaries work, too!
- Results are similar to variables. They have a name and an expression that they will become.
python examples/starting/example1.py to create the profile needed for the deployment.
To deploy the script run
lmrtfy deploy examples/starting/example1.py --local
example1 from code¶
Now you can simply call
catalog.example1() with the correct arguments, and you are good to go:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<your_namespace>is your private namespace on LMRTFY, which is typically your nickname. Available namespaces are shown when importing
catalogor when calling
if job: is currently required to ensure that you actually got a job object back from the function
which would not be the case if the submission failed.
example1 from the CLI¶
We encourage you to use code to submit jobs and get results.
During the deployment you should have received a seven letter
Profile_id to be used for requests: CgHUejl
We need the
profile_id to submit a job from the CLI:
lmrtfy submit CgHUejL examples/starting/example1.json
If the JSON file has the correct inputs, in a valid range with correct units you will see that the job submission was successful. You will receive a ten-letter job ID.
INFO Job submission successful. INFO Job-id: HgaUbcTFah
job_id you can now get the job results:
lmrtfy fetch HgaUbcTFah .
That's all that is to it. Happy Hacking!