How to break marketplace execution logs
Alli Marketplace Executions can be filled with tedious dependencies and other information not important to client users. We now let you choose where to break the log in order to have a neat display for clients that only want the output, while keeping the rest of the log in a separate tag for those who need to read. To break the logs use the new environment ‘LOG_BREAK' and print it (or echo for bash users) right before the message you want to display. The new tab layout will be:
Output - Everything after print(os.environ[‘LOG_BREAK’])
Dependency details - all import and download logs
Job Details - contains AWS container information for better tracking
Here’s an example of using the variable.
import os
import pprint
import requests
token = os.environ['ALLI_OAUTH_TOKEN']
token_type = os.environ['ALLI_OAUTH_TOKEN_TYPE']
log_break = os.environ['LOG_BREAK']
resp = requests.get("https://api.central.allistaging.com/me", headers={
'Authorization': f'{token_type} {token}',
})
resp.raise_for_status()
print(log_break)
pprint.pprint(resp.json())
The output created by this will have all the dependency downloads kept in the ‘Dependency Details’ tab of the execution table here.
While the desired information for clients will be logged here in the ‘Output’ tab.
WARNING: Only print the ‘LOG_BREAK` variable once. If you print it more than once all information after the second print will be lost from display.