Setting tasks when batch importing multiple versions

We are receiving versions from an external vendor that need to be imported into our shotgun.
We upload several versions at once, then add a submission sheet that will update information for the shots. So far, so good.

In order for our system to work correctly, every version needs to be connected to a task, and this is where we are having trouble. Every shot only has one task - Comp, in this case.

We can’t seem to find a way to use the batch import with a submission sheet to set the Task correctly. The field shows up as Task>Shot>Shot Code on the versions page, but cannot be assigned on import. When we try set Task to Comp on import, it will only use the first value for all shots we import.

Any ideas how that can be solved with bulk import?

Thanks, Alex

6 Likes

How many versions are you importing at a time? I’ll be interested to see what folks respond to with this, because typically when I’ve bulk uploaded I’ve just done a quick manual “attach” to the correct shots & tasks once the versions are in Shotgun. (But in my case we talking maybe 20 at a time, maximum.)

2 Likes

At the moment, not to many - only 10 or so - but soon we’ll be dealing with a lot of submissions (this is a 600+ shots show). So we are trying to avoid manual work as much as possible.

For our internal projects, we have a direct Nuke-Shotgun bridge that handles our versioning, and that sets everything correctly. But it would be nice to know if this is possible at all.

1 Like

Hey Marvin,

As you’ve found, the Importer does a simple name match. So when you input “Comp” it will just find the first Task in the Project with the name “Comp” and link that up.

As a workaround to account for this, you could use the API to help link things up after your initial import. Here’s the snippet:

# Find all Versions in a given Project where the linked entity is a Shot, and the Task field is empty
versions = sg.find('Version', [['sg_task', 'is', None], ['entity', 'type_is', 'Shot'], ['project', 'is', {'type':'Project', 'id':74}]], ['entity'])

# Iterate over those Versions, find the Task named "Comp" linked to the Shot, then update the Version with that Task
for v in versions:
   task = sg.find_one('Task', [['entity', 'is', v['entity']], ['content', 'is', 'Comp']])
   sg.update('Version', v['id'], {'sg_task': task})
   print "Updated Version ID: "+str(v['id'])+" with Task ID: "+str(task['id'])

Let me know if that helps make your import process a little smoother!

6 Likes

Thanks! We’ll have a look and see how it goes. The tricky bit is that the versions are uploaded with a certain status - but this won’t be reflected in shot status until the Comp Task is linked, so we will have to have another script that changes the Task status after the linking …

1 Like