Connectors

Contact support

Running apps (manual, schedule etc.)

Running apps (manual, schedule etc.)

Run modes

You can run a Peliqan script (data app) in different ways:

  • Manual interactive run: click the “Save & Run” button in the top menu above the script editor in Peliqan
  • Scheduled run: configure a schedule for your script
  • Publish API endpoint: make your script available as a public API endpoint. More info:
  • Publish APIs

Scheduling runs

Use the “Schedule” menu option in the top menu of the script editor, activate the schedule and choose an interval:

  • 1 minute
  • 5 minutes
  • 15 minutes
  • 30 minutes
  • 1 hour
  • 6 hours
  • 12 hours
  • 24 hours

image

If your script takes a long time to complete and is still running when the next interval arrives, the next run will be queued. The scheduler will make sure that your script is never running twice at the same time (no parallel runs).

If you want to run your script e.g. every Monday or once a week, choose a daily schedule and check for the day of the week or date in the code. Example:

from datetime import datetime
dt = datetime.now()
today = dt.strftime('%A')

if today == "Monday":
	# do stuff
else:
	# don't do anything
	pass

View logs

For each run of your script, you can view the logs under the “Logs” menu item:

image

Detect run mode inside a script

You can use the predefined constant RUN_CONTEXT in your script to detect the run mode (run context):

if RUN_CONTEXT == 'scheduled':
	st.write("We are in a scheduled run")

if RUN_CONTEXT == 'interactive':
	st.write("You are running this script manually")

if RUN_CONTEXT == 'api_handler':
	st.write("Script invoked via a published API endpoint")