Test apps
Once you have prepared a Towerfile and changed your app code to receive secrets and parameters, you are ready to test the app. We recommend starting with a python run, then a local Tower run, and then a run in the Tower cloud.
Run your main script in python
Make sure your main script runs in python successfully.
python mainscript.py
Run app locally
Tower offers a local execution mode. Use this mode to verify that your app is compatible with the Tower remote execution environment.
tower run --local
Deploy the app to Tower
Now that you’ve tested the app locally, you can deploy the app to Tower and run it there. You can use the “tower deploy” command to do this.
tower deploy
Run in a test Tower environment
If you have a separate testing environment that you use to test your apps before promoting your app to production, you can set up Tower to align with this process.
Using multiple environments in Tower means passing different values of secrets, so that your app can connect to different databases.
You can set different values for secrets that you want to differ from environment to environment.
tower secrets create --name=snowflake_url \
--value=https://abc123-prod.snowflake.com \
--environment=test
Later, you can run an app in an environment that you specify on the command line. When running your app, Tower will inject the correct value of the secret, so you don’t have to have special processing logic to handle different environments.
tower run --environment=test
However, if your app code does need to know in which environment the app is running - e.g. so that you can pick different database engines depending on the environment - you can do this via the TOWER_ENVIRONMENT variable
tower_env = os.getenv("TOWER_ENVIRONMENT")
Get app status and logs from Tower
Once you initiate your first run in Tower, you can get the app status and run logs.
Execute “tower apps show” command to get a list of all app runs.
tower apps show <app-name>
Execute “tower apps logs ” command to get logs of the specified run
tower apps logs <app-name>#<run-number>