This guide walks through how to configure hooks within your Workspace.
A hook is a configured command line that points to script on your servers, that is executed by accsyn on certain triggers within accsyn:
pre-submit-server; Executed on the server before a job is submitted, with job data provided.
post-submit-server; Executed on the server after a job is submitted, with job data provided.
post-failed-client; Executed on the remote client when a job has failed, with job data provided.
post-failed-server; Executed on the server when a job has failed, with job data provided.
post-done-client; Executed on the remote client when a job has finished, with job data provided.
post-done-server; Executed on the server when a job has finished, with job data provided.
pre-publish-server; Executed on the server when a remote user requests to publish one or more files, with publish file data provided and expecting feedback to provided back to accsyn (see Publish workflow)
publish-server; Executed on the server when the published files from remote user has been uploaded, with publish file data provided (see Publish workflow)
When a hook execution event triggers, accsyn executes the configured hook script on the default server:
Data related to the specific hook is compiled and written to a temp JSON file, see syntax below.
The configured script command line is loaded and the expression "${PATH_JSON_INPUT}" is replaced with the full absolute path the temp JSON input file. This enables the script to load the metadata from arguments.
When required (pre-publish-server hook), a temp path is generated and replaces "${PATH_JSON_OUTPUT}". This enables the script to write back data to accsyn as needed.
The script is executed, by the same system user are accsyn (daemon) is running on the server.
Here follows example hook input data, as beeing passed on to the "post-done-server" hook after the file "moonshot.tif" was uploaded to a project share:
Breakdown of JSON data:
metadata; Job metadata, aggregated upstream over queue, share, volume and workspace (global). For server side hooks, both internal (workspace private) and external (public) metadata are provided separately. For client side hooks, only the external metadata is provided in case the party is a user having the standard role.
clients; The client(s) involved in execution, identified by role attribute: server = the main site transfer part or compute execution server, client = the remote side of a transfer, either a user's desktop app/server or the site server.
client.metadata; Client metadata, aggregated upstream over workspace.
code & name; The job human readable identifier.
source; accsyn raw source party ident, on the form "<entitytype>:<entityid>".
source_hr; Source party on human readable form.
destination; accsyn raw destination party ident, on the form "<entitytype>:<entityid>".
destination_hr; Destination party on human readable form.
version; The accsyn backend version.
hook; The name of the hook.
size; The size of the job - sum of non excluded task sizes.
engine; The engine ID.
engine_hr; The engine name (code).
id; The ID of the job.
user; The ID of the user that created the job.
user_hr; The email address of the user creating the job.
created; The date job were created.
queue; The ID of the parent queue job is in.
queue_hr; The name of the parent queue job is in.
tasks; Job tasks dictionary, providing detailed information about transfer source and destination (full path and share/volume relative paths).
status; The status of the job during hook execution.
For detailed information about the publish hooks, header over to the Publish documentation.
To configure hooks globally, logon as administrator to https://accsyn.io/admin/settings:
Click on the Hooks settings tab.
Click the edit(pen) icon on Hook configuration setting.
3. Click Enable hooks to have hook subsystem enabled.
4. If you want to run the hooks on a different server than the default (serving default volume at main site), choose the server @ Hook execution server.
5. Audit; Define by base role, which users are allowed to audit the hooks and read the execution logs.
6. Choose which hook you want to configure.
6. Click Enable.
7. Choose the entry matching the operating system your server is running, enter the local full path your script. Keep the token "${PATH_JSON_INPUT}" - it will be replaced with the path to the temp JSON input data at runtime. (Same goes for ${PATH_JSON_OUTPUT} with the pre-publish-server hook)
Click [ Save ] when done to apply your hooks configuration. Test the hook by submitted a job / performing a publish.
Hooks can be overridden, or just be configured on a queue. See Queue administration.
Use the Python API within your hook, for example to program chained file transfer workflows.
A tutorial going through how to setup an outsourcing pipeline with accsyn, using publish hooks.