November is the month of calm before the New Year storm. Additionally, it is the first month of the rainy season in many regions. Our AnyLogic Cloud is not a rain cloud, but rather one that uplifts your November days with a 2.3.1 release.
The minor release number should not give the impression of minor improvements as there are plenty of major ones and new features.
Clickable hyperlinks in the model description
I love convenient UI and UX. So, if I can save several mouse and keyboard clicks for an action like sharing a model in WhatsApp or opening a whitepaper linked to a model, then I am happy. Unlike functional improvements, which affect only users who need them, UI/UX improvements affect almost all users. Let’s take a closer look at these improvements.
Everyone knows how inconvenient it is when a hyperlink is just plain text, and you have to select the link text or type it manually. This was how we used to do it until the 2.3.1 release. Now, check out how one of the most popular models, Urban Dynamics Educational Simulator, looks like below.
Social media sharing
Attentive readers might also have noticed another new element in the screenshot above – five social media share buttons. With these buttons you can say goodbye to annoying copy-paste links. Just press the respective social network or messenger option and choose the recipients.
And good news for Private Cloud administrators – you can adjust the buttons presence with this configuration file (don’t forget to restart the Private Cloud controller to apply the changes).
Cloud API now supports file as input and file as output features
UI/UX improvements are great, but what about core functionality updates? Experienced AnyLogic Cloud users and those who design complicated custom workflows featuring Cloud API lacked complete support for all inputs and outputs available in the Cloud UI, namely file input and output.
Now, thanks to AnyLogic Cloud 2.3.1, this discrepancy has been solved. By the way, before we carry on, if you don’t know how to work with files in Cloud UI, watch this short how-to video to quickly learn how it works.
- Cloud API is available to subscribers or Private Cloud users. To become a subscriber or Private Cloud owner, please have a look at the purchase page. For testing purposes, you may use the API key and example model from the documentation.
- Find the API key in your profile:
- Get the AnyLogic Cloud client library. In my case I use Python, so I can install the library using the pip package installer:
pip install https://cloud.anylogic.com/files/api-8.5.0/clients/anylogiccloudclient-8.5.0-py3-none-any.whl
- Open your favorite IDE, and make sure you use the Python interpreter with the library installed. Then enter this code:
- To run the script successfully, you will need to replace all placeholders like API_KEY, MODELNAME with real names. For this purpose, please use a model with an input file and output file. If you don’t have such a model (or if you are simply testing Cloud API), you may use this example model and Cloud API documentation.
- Run the code, and if everything is fine you should get the following picture:
- Finally, open the folder where the script is stored – there you should be able to find the downloaded output file. Its name starts from ‘output_’
from anylogiccloudclient.client.cloud_client import CloudClient def main(): print("Authorizing and uploading input file ...") #replace API_KEY and CLOUD_URL respetively client = CloudClient("API_KEY", "CLOUD_URL") #replace FILENAME with real filename input_file_hash = client.upload_file("FILENAME") print("Setting up simulation File IO API Demo ...") #replace MODELNAME with real name of a model listed in My Models section of your Cloud account version = client.get_latest_model_version("MODELNAME") inputs = client.create_default_inputs(version) #replace INPUT_NAME with the respective input name inputs.set_input("INPUT_NAME", input_file_hash) print( "Running simulation...") simulation = client.create_simulation(inputs) outputs = simulation.get_outputs_and_run_if_absent() print( "Downloading file populated with output data...") #replace OUTPUT with the respective input name output_file = outputs.value("OUTPUT_NAME") client.download_file(output_file, "output_" + output_file.name) if __name__ == '__main__': main()
If we look at the code from step number 4 in more detail, we can identify four key functions:
- CloudClient.uploadFile( file ) – uploads the file to the Cloud and returns its hash. It is not necessary to upload the same file in different experiments and models – just remember the file hash for further usage in set_input function.
- Inputs.set_input( input_name, file_hash ) — here we tell the Cloud what file we need for the model run.
- Outputs.value( output_name ) — gets the respective output from the experiment results. The output file is just a regular model output. Here you should specify the output name.
- CloudClient.download_file( output_file ) – downloads the file according to the specified FileResource from the AnyLogic Cloud. In a little bit more detail, FileResource is a result of the previous function and contains the file hash and file name.
What’s really great is that you may specify the same file as both input and output, e.g., an Excel document with two sheets (for input data and output data respectively).
You upload the file with the filled input sheet and the empty output sheet. Then your model is executed, and the output file is generated. It contains both sheets filled with the respective data. And the Cloud stores both files, so you don’t need to reupload the input file with the initial input data. You may then reuse it in other experiments. This workflow is demonstrated in this example model.
OK, enough coding for this post.
Cloud search now supports complex parameterized queries
Our next improvement is advanced search patterns. In previous Cloud versions you could search by name and by tag. This was good, but not good enough!
Now you can get all your models with a single search query. Below we can see the results of a query - all models developed by the AnyLogic team.
And by the way, now you can use the custom search patterns to create a rich model gallery featuring public community models for each industry page. You may find a comprehensive description of advanced search usage along with examples in our online documentation.
Adjustable password policy
Finally, here is the last notable improvement from the release notes. If you work in a large company with a security department, you will know that InfoSec requirements include a number of upper- and lowercase letters, special characters, numbers, and overall password length.
Now Private Cloud admin may adjust these requirements according to their company standards. The policy is stored in the Private Cloud configuration file, namely ‘registration.json’. You may open the file in any text editor and adjust the respective values, e.g., "numberOfDigits": 1, which means that the password must contain at least one digit. Then save the file and restart your Private Cloud controller.
As usual, comprehensive documentation about Cloud password policy configuration may be found in our online documentation.
The final word
If this is the first time you need to administer the private Cloud – our administration guide is at your service! You may start from the Architecture and Configuration files articles of the guide. Should you have any questions or feature requests – please contact the Support Team.
Thank you for reading this post! To test the new Cloud release in action please visit the AnyLogic Cloud site. To update your Private Cloud please follow the Private Cloud: Update article from the Private Cloud administrator guide.