Can code tell if it's running in the tarpit?

If I'm running a low priority background task and I end up in the tarpit, I'd prefer just to stop. Can I check from Python if I'm in the tarpit?

In general, is there a library for interrogating the PA environment?

-- Graeme

You can use the API to access PA functions, but I don't think there's a tarpit checking endpoint. I suppose you can do some web scraping to check too.

@acehouse is right, we don't have an API for checking if you're in the tarpit right now. It's on our to-do list, though, and I've added an upvote on your behalf.

Here it is:


GET Returns information about cpu usage in json format:

    "daily_cpu_limit_seconds": <int>,
    "next_reset_time": <isoformat>,
    "daily_cpu_total_usage_seconds": <float>

see the new blog post.