App
An App is a python application that is installed on a Node in the InfraX network. It is used to execute user created Jobs and interact with the InfraX network.
Getting Started¶
Apps can be tested locally on your machine before being deployed to the InfraX network. To get started with creating an App, follow these steps:
- Create a new directory for your App on your local machine.
- Inside the directory, create the following subdirectories:
- Create a
main.py
file in the root of the directory. This file should contain the main logic of your App. - (Optional) Create a
requirements.txt
file in the root of the directory if your App has any dependencies. - Test your App locally by running
python main.py
in the terminal. - Once your App is working as expected, you can deploy it to the InfraX network by using the frontend interface.
Structure¶
When the App is run on a Node in the InfraX network, the system will place input files in the input
directory and expect output files to be generated in the output
directory. Any files placed in the output
directory will be collected by the system and made available to the user.
Example main.py
file:
- Read input files from the
input
directory. Files are placed in theinput
directory by the system when a user creates a Job, if the app requires input files. - Generate output files in the
output
directory
Warning
The input
and output
directories are created by the system when the App is run on a Node. Do not create these directories yourself as they will be overwritten by the system.
Keyword Arguments¶
The primary method of nteracting with an App is through files uploaded when a user creates a Job. This should satisfy most use cases. That said, there are some scenarios where additional input is required. This can be achieved by specifying keyword arguments when creating an app through the frontend interface. These arguments will be passed to the App at runtime as stdin
keyword arguments.
Note
The maximum length of each argument is 1024 characters. If you require more data, consider requiring a file upload (or multiple files) instead.
Example file with argument message_string="Hello InfraX!"
specified:
Info
Any stdout
or stderr
output generated by the App will be captured by the system and made available to the user in the Job output
.
States¶
An App can be in one of the following states:
- CREATED
- The App has been created by a user and is ready to be deployed to the InfraX network.
- TESTING
- The App is being tested by the author to ensure it works as expected. The App is not available for users to discover. Only the author can see the App and create Jobs against the app in this state.
- PUBLISHED
- The App has been published to the InfraX network and is available for users to discover and create Jobs with. The App can no loger be edited by the author.
- HIDDEN
- The App has been hidden from the InfraX network and is no longer available for users to discover. The App can no loger be edited by the author.
- ERROR
- The App has encountered an error and is no longer available for users to discover. The App can no loger be edited by the author.
- REMOVED
- The App has been removed from the InfraX network and is no longer available for users to discover. The App can no loger be edited by the author.