Automated system that keeps Resilio Active Everywhere hybrid work jobs connected to ShotGrid shot statuses and task assignments.
This Firebase Cloud Function service monitors ShotGrid webhooks and automatically manages Resilio Connect jobs to ensure artists have access to the right files at the right time. When shots become active or artists are assigned/removed, the system creates, updates, or deletes Resilio HybridWork jobs accordingly.
- Creates Resilio jobs when shots become active and artists are assigned
- Updates jobs when artist assignments change
- Deletes jobs when shots become inactive or all artists are removed
- Sets up One job per shot with all assigned artists as end user agents
- Handles multiple artists on a single task (e.g Comp assigned to Alex + Matthew)
- Aggregates artists across multiple tasks per shot (e.g Alex on Comp, Matthew on Paint)
- Adds/removes artists/agents from jobs as assignments change
- Creates shared asset jobs for each project (this can be expanded depending on needs, it's a simpler placeholder for a more robust assets workflow)
- Includes all artists working on any shot in that project
- Automatically manages access as artists join/leave projects
- YAML-based artist and path configuration
- Cross-platform file paths etc...
- Configurable primary storage and target agent mappings (should align with SGTK templates and or schema)
Needs these webhooks on your ShotGrid site:
- Event Type:
Shotgun_Shot_Change - Conditions:
sg_status_listfield changes - URL:
https://your-firebase-url/shot_status_webhook - Triggers: Full sync when shots become active/inactive (uses a status with shortcode currently set to
active)
- Event Type:
Shotgun_Task_Change - Conditions:
task_assigneesfield changes - URL:
https://your-firebase-url/assignment_webhook - Triggers: Changes Resilio job configurations when artists are added/removed from tasks
{
"SHOTGRID_API_KEY": "your_api_key",
"SHOTGRID_SCRIPT_NAME": "webhooks",
"SECRET_TOKEN": "your_webhook_secret",
"SHOTGRID_URL": "https://your-site.shotgrid.autodesk.com",
"RESILIO_URL": "https://your-resilio-console:8446",
"RESILIO_TOKEN": "your_resilio_token"
}# Primary storage configuration
primary_storage:
agent_name: "Linux_Remote"
agent_id: 4
base_path: "/home/Company"
# Target agents - where files sync to
target_agents:
Matthew Testuser:
agent_name: "Cameron's Mac mini"
agent_id: 3
base_path: "/Volumes/Company"
Alex Trial:
agent_name: "Cameron's MacBook Pro"
agent_id: 2
base_path: "/Volumes/Company"
# Path templates
path_templates:
shots_template: "${PROJECT}/2_WORK/1_SEQUENCES/${SEQUENCE}/${SHOT}"
assets_template: "${PROJECT}/2_WORK/2_ASSETS"
# Job settings
job_settings:
auto_create_paths: true
folder_permissions: "755"
sync_direction: "bidirectional"- ShotGrid: Shot TST_010_0010 status changes to "active"
- Webhook:
shot_status_webhookreceives event - System: Queries all active shots and their assignments
- Result: Creates
HybridWork_TST_TST_010_0010job with assigned artists
- ShotGrid: Alex assigned to TST_010_0010 Comp task
- Webhook:
assignment_webhookreceives event - System: Triggers full sync for active shots
- Result: Updates job to include Alex as end user
- ShotGrid:
- Alex assigned to TST_010_0010 Comp
- Matthew assigned to TST_010_0010 Paint
- System: Aggregates all artists across all shot tasks
- Result: Job includes both Alex and Matthew as end users
- ShotGrid: Alex removed from TST_010_0010 tasks
- Webhook:
assignment_webhookreceives event - System: Detects Alex no longer assigned to shot
- Result: Updates job to remove Alex, or deletes job if no artists remain
Refer to Firebase Docs to login and init your firebase project.
# Deploy all functions
firebase deploy --only functions
# Deploy specific function
firebase deploy --only functions:shot_status_webhook
firebase deploy --only functions:assignment_webhook- Firebase CLI
- Python 3.11 (complying with VFX reference platform)
- Notable dependencies:
firebase_functions,shotgun_api3
- INFO: Normal operation, sync results
- DEBUG: Detailed payload and state information
- WARNING: Non-fatal errors, invalid configurations
- ERROR: Critical failures, API connection issues
"Shot status webhook triggered - starting full Resilio sync""Task assignment webhook triggered - triggering shot status sync""Sync complete - Created: X shot, Y assets | Updated: X shot, Y assets | Deleted: X shot, Y assets""Jobs to delete: X, create: Y, check for updates: Z"
- Jobs not created: Check artist configuration in
artists.yaml - Jobs not deleted: Verify webhook signature and authentication
- Path issues: Confirm path templates and agent base paths
- API errors: Check Resilio Connect credentials and connectivity
- Check Firebase Functions logs
- Verify ShotGrid webhook delivery
- Test API connections manually
- Validate configuration files
Main synchronization function that ensures Resilio jobs match ShotGrid state.
Parameters:
sg_state: Current ShotGrid state fromget_active_shots_with_assignments()resilio_url: Resilio Connect management console URLresilio_token: Resilio Connect API token
Returns:
{
'shot_jobs_created': int,
'shot_jobs_updated': int,
'shot_jobs_deleted': int,
'assets_jobs_created': int,
'assets_jobs_updated': int,
'assets_jobs_deleted': int,
'artists_processed': int,
'errors': [],
'details': []
}Queries ShotGrid for all active shots and their task assignments.
Returns:
{
'shots': [
{
'id': 123,
'code': 'TST_010_0010',
'project': {'name': 'Test Project', 'tank_name': 'TST'},
'sequence': 'TST_010',
'assigned_artists': ['Matthew Testuser', 'Alex Trial']
}
],
'artist_projects': {
'Matthew Testuser': ['TST', 'TST2'],
'Alex Trial': ['TST']
}
}Retrieves all HybridWork jobs managed by the system.
Returns: List[Dict[str, Any]] - List of job objects
Creates a new hybrid work job in Resilio Connect.
Parameters:
job_attrs: Job configuration dictionaryignore_errors: Boolean to ignore creation errors
Returns: int - Job ID
Updates the agent configuration for an existing job.
Parameters:
job_id: Resilio job IDjob_name: Job name for loggingexpected_agents: List of agent configurations
Returns: bool - Success status
Deletes a job from Resilio Connect.
Parameters:
job_id: Resilio job ID
Compares current job agents with expected configuration.
Parameters:
job: Current job objectexpected_agents: Expected agent configuration
Returns: bool - True if configurations match
Constructs the primary storage path for a shot.
Example: /home/Company/TST/2_WORK/1_SEQUENCES/TST_010/TST_010_0010
Constructs the target agent path for an artist and shot.
Example: /Volumes/Company/TST/2_WORK/1_SEQUENCES/TST_010/TST_010_0010
Constructs the primary storage assets path.
Example: /home/Company/TST/2_WORK/2_ASSETS
Constructs the target agent assets path.
Example: /Volumes/Company/TST/2_WORK/2_ASSETS
