parent
93e234736c
commit
586888c761
3 changed files with 9 additions and 1 deletions
2
.github/workflows/get_context.yml
vendored
2
.github/workflows/get_context.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
- name: Get Directory structure
|
- name: Get Directory structure
|
||||||
run: ls -lR
|
run: ls -lR
|
||||||
- run: python find_posts.py --lock-hours=0 --access-token=${{ secrets.ACCESS_TOKEN }} --server=${{ vars.MASTODON_SERVER }} --reply-interval-in-hours=${{ vars.REPLY_INTERVAL_IN_HOURS || 0 }} --home-timeline-length=${{ vars.HOME_TIMELINE_LENGTH || 0 }} --max-followings=${{ vars.MAX_FOLLOWINGS || 0 }} --user=${{ vars.USER }} --max-followers=${{ vars.MAX_FOLLOWERS || 0 }} --http-timeout=${{ vars.HTTP_TIMEOUT || 5 }} --max-follow-requests=${{ vars.MAX_FOLLOW_REQUESTS || 0 }}
|
- run: python find_posts.py --lock-hours=0 --access-token=${{ secrets.ACCESS_TOKEN }} --server=${{ vars.MASTODON_SERVER }} --reply-interval-in-hours=${{ vars.REPLY_INTERVAL_IN_HOURS || 0 }} --home-timeline-length=${{ vars.HOME_TIMELINE_LENGTH || 0 }} --max-followings=${{ vars.MAX_FOLLOWINGS || 0 }} --user=${{ vars.USER }} --max-followers=${{ vars.MAX_FOLLOWERS || 0 }} --http-timeout=${{ vars.HTTP_TIMEOUT || 5 }} --max-follow-requests=${{ vars.MAX_FOLLOW_REQUESTS || 0 }} --finished-callback=${{ vars.FINISHED_CALLBACK }}
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -88,6 +88,7 @@ Please see below for a list of configuration options.
|
||||||
| `MAX_FOLLOW_REQUESTS` | `--max-follow-requests` | No | Provide to backfill profiles for the API key owner's most recent pending follow requests. Determines how many of your last follow requests you want to backfill. (An integer number, e.g. `80`.). Requires an access token with `read:follows` scope.
|
| `MAX_FOLLOW_REQUESTS` | `--max-follow-requests` | No | Provide to backfill profiles for the API key owner's most recent pending follow requests. Determines how many of your last follow requests you want to backfill. (An integer number, e.g. `80`.). Requires an access token with `read:follows` scope.
|
||||||
| `HTTP_TIMEOUT` | `--http-timeout` | No | The timeout for any HTTP requests to the Mastodon API in seconds. Defaults to `5`.
|
| `HTTP_TIMEOUT` | `--http-timeout` | No | The timeout for any HTTP requests to the Mastodon API in seconds. Defaults to `5`.
|
||||||
| -- | `--lock-hours` | No | Determines after how many hours a lock file should be discarded. Not relevant when running the script as GitHub Action, as concurrency is prevented using a different mechanism.
|
| -- | `--lock-hours` | No | Determines after how many hours a lock file should be discarded. Not relevant when running the script as GitHub Action, as concurrency is prevented using a different mechanism.
|
||||||
|
| `FINISHED_CALLBACK` | `--finished-callback` | No | Optionally provide a callback URL that will be called when processing is finished. This can be used for 'dead man switch' monitoring of cron jobs, for example via healthchecks.io.
|
||||||
|
|
||||||
#### Required Access Token Scopes
|
#### Required Access Token Scopes
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ argparser.add_argument('--max-followers', required = False, type=int, default=0,
|
||||||
argparser.add_argument('--max-follow-requests', required = False, type=int, default=0, help="Backfill posts of the API key owners pending follow requests. We'll backfill at most this many requester's posts")
|
argparser.add_argument('--max-follow-requests', required = False, type=int, default=0, help="Backfill posts of the API key owners pending follow requests. We'll backfill at most this many requester's posts")
|
||||||
argparser.add_argument('--http-timeout', required = False, type=int, default=5, help="The timeout for any HTTP requests to your own, or other instances.")
|
argparser.add_argument('--http-timeout', required = False, type=int, default=5, help="The timeout for any HTTP requests to your own, or other instances.")
|
||||||
argparser.add_argument('--lock-hours', required = False, type=int, default=24, help="The lock timeout in hours.")
|
argparser.add_argument('--lock-hours', required = False, type=int, default=24, help="The lock timeout in hours.")
|
||||||
|
argparser.add_argument('--finished-callback', required = False, default=None, help="Provide a callback url that will be pinged when processing is complete. You can use this for 'dead man switch' monitoring of your task")
|
||||||
|
|
||||||
def pull_context(
|
def pull_context(
|
||||||
server,
|
server,
|
||||||
|
@ -759,6 +760,12 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
os.remove(LOCK_FILE)
|
os.remove(LOCK_FILE)
|
||||||
|
|
||||||
|
if(arguments.finished_callback != None):
|
||||||
|
try:
|
||||||
|
get(arguments.finished_callback)
|
||||||
|
except Exception as ex:
|
||||||
|
log(f"Error getting callback url: {ex}")
|
||||||
|
|
||||||
log(f"Processing finished in {datetime.now() - start}.")
|
log(f"Processing finished in {datetime.now() - start}.")
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
|
Loading…
Reference in a new issue