Native Applications#

Native Applications are containerized web applications that run on Edge resources. They provide a frontend web user interface, with backends that perform long running computational tasks. Native Applications can be run on a variety of Compute Profiles that feature a variety of memory sizes, CPU counts and GPU counts.

When a user launches a Native Application, Edge will create and host an individual instance for that user. Edge Compute Profiles can be assigned more computational resources than a traditional Desktop application. Users are free to interacting with the Native Application while long running compute tasks run on Edge in the background without tying up local Desktop resources.

Native Applications also have access to Edge data resources such as Edge hosted files. They can perform tasks on files without having to transfer them to a user's Desktop system. In addition, they benefit from Edge's Authentication system.

Compute Profiles#

Applications instances can be started with a recommended profile, or one may be selected by a user by opening the Application tile's start menu and selecting a Compute Profile

Application start menu Compute profiles

When registering an application, an application can use predefined Compute Profiles:

Profile Name

Display Name

CPUs

GPUs

Memory in Gb

edge.small

small

2

0

1.1

edge.medium

medium

2

0

2.9

edge.large

large

2

0

6.4

edge.xlarge

extra large

4

0

13

edge.gpu.xlarge

GPU extra large

4

1

13

The default profile for Native Applications is edge.small. A Native Application can also specify a recommended profile.

Authoring a Native Application#

The Edge Native App Example provides a convenient template for developing Native Applications. It consists of a Flask backend, React frontend client and CI tools. Authoring a Native Application typically involves the following tasks:

  • Create a Native Application using the Edge Native App Example as a template

  • Develop and test the Native Application locally

  • Build a Docker image and publish it

  • Register the application on Edge

The example application CI tools are ideal for performing these tasks:

  • python -m ci watch backend runs the application in a local development mode with live reload

  • python -m ci watch frontend compiles the React frontend and provides live reload

  • python -m ci build will create a local Docker image

  • python -m ci start launches a local Jupyter instance for testing

  • python -m ci publish publishes the Docker image to an image repository for deployment on Edge

Native Application Architecture#

Native Applications typically consist of a backend API and a frontend client. The backend is also responsible for serving the frontend files for a browser to render the frontend. When a user launches an instance of the application Edge will provide routing to the backend through Edge's domain edge.enthought.com.

The Edge Native App Example performs face detection image processing on any images that are submitted via drag and drop. Native Applications should perform long running compute tasks in a non-blocking fashion using subprocesses.

Native Application Requirements#

There are several requirements for the application to provide long running background computation and to work with Edge's Authentication system and routing. We will use the Edge Native App Example as a reference for how these requirements can be implemented. This example application uses Flask as a backend and React as a frontend.

Environment Variables#

Edge provides several environment variables to Native Application instances. These environment variables are required for configuring application routing and integrating with Edge's authentication system.

Automatic Authentication#

Edge handles all of the details of logging a user in. The Native Application only needs to define decorators for checking a user's login state with Edge and define an endpoint for handling Edge's authentication callback. For more details, see the README.md in the Native Application Example GitHub Repository.

Activity Tracking#

Edge automatically terminates Native Application instances that are idle. The application backend should periodically report activity to Edge by performing a POST operation. In the example application, this is done using a track_activity decorator.

Application Routing#

Edge creates a unique path for each user's Native Application instances. This path is provided to the Native Application instance via environment variables, and a user will be redirected to this path on Edge's web domain. For details of how to configure routing, see the README in the Native Application Example GitHub Repository.

Publishing a Native Application#

Native Applications can be published by pushing the application's Docker image to a Docker image repository and registering the application on Edge. It is recommended that quay.io be used as a Docker image repository host. To publish a Native Application, you will need the following:

  • A provisioned Docker image repository, such as a repository on quay.io

  • A deployment username and password for the Docker image repository

  • A built container that has been pushed to the Docker image repository

The instructions for Publishing an Application are designed for publishing a Native Application. When registering the AppVersion, you must specify that the version type is AppKindEnum.Native and provide the address of the Docker image repository. In addition, you must register a ServerInfo object with the Application that provides the registry domain, username and password for pulling the Docker image.