0

Send publish notifications to relevant artists

Hi,

I want to send notifications to artists when a publish for a related task happen. By related, I mean I'd like to handle these cases:
  • an animator publishes a new animation cache for shot XXX => artists assigned to lighting tasks on shot XXX
  • a modeler publishes a new model of asset YYY => artists assigned to rigging and lookdev tasks on asset YYY
  • a rigger publishes a new rig of asset YYY => artists  assigned to animation tasks on shots containing the asset YYY 
I'm thinking that this action should happen in the event daemon rather than in the publish tools. Please tell me if you think otherwise!
Next, how to detect that a publish has completed and can be processed? When the primary publish is registered in Shotgun, none of the secondary outputs have been generated. I'd like to know about them so I can send notifications that mention everything that's been published (eg. cache for actor xxx, cache for actor yyy, etc.) There is no "publish complete" event recorded. Also, I can't rely on the fact that the publish would be complete by the time the publish is detected by the daemon because publishes can take a long time (eg. anim cache to generate).
I could add a field in the primary publish that says: this publish contains 2 caches xxx and yyy, but ultimately this will be redundant once the publish is finished.
I thought about a kind of boolean on the PublishedFile to say if it's in progress or complete, and discovered that there's already a "Published Status"  field (sg_status_list) , with meaningful entries: in progress, complete, approved. This covers what I want and more!
But shouldn't Toolkit set these values already? I looked at a simple way to set the values, the most logical place would be the post_publish hook in tk-multi-publish, but the hook doesn't receive the shotgun entries, so I would have to do the queries again in the hook to find what has just been published, which I find weird. Shouldn't it be handled directly in the app?
Is there a better way to do all that?
Have you done something similar?
Thanks,
Benoit

6 comments

  • 0
    Avatar
    Julien Dubuisson

    Hi Benoit,

    I'm doing something along those lines here but I haven't played that much with the multi-publish app so my answer may not apply exactly to your case.

    I generally handle the status update directly in the publish hooks because I don't want the post-publish hook to wait for some of the longer publishes to finish.

    All the potentially longer publishes we do are published before hand with a "In Progress" status and are send to the farm linked together so that when they are all done a farm callback updates the status of the relevant shotgun entries. I can do that because our publisher keep the various shotgun entries created and pass them to the secondary publishes. 

    Looking at the multi-publish you don't have that in the secondary_publish hook but you do have the path to the primary publish so querying Shotgun to get the entry may not be that expensive. And you will do that query only once for all the secondary publishes

     

    Hope it helps.

    Julien

  • 0
    Avatar
    Benoit Leveau

    Hi Julien,

    Thanks for the reply. I indeed think I'll do that in the secondary publish hook, where I'll have all the relevant information and can easily find the shotgun entry for the primary, as you pointed out.

    Also, you describe a neat way to handle long publishes, I'll keep that in mind for a future improvement of our pipeline.

    Thanks,

    Benoit

  • 0
    Avatar
    Alan Dann

    Thanks for answering this Julien :)

    One thing I'd add is that it is possible to pass information from the primary publish hook through to the secondary publish hook.  To do this, set your own data in the other_params field on the item in the primary publish and you can then access it in the secondary publish hook, for example:

    # Primary publish hook:

    def execute(self, task, work_template, comment, thumbnail_path, sg_task, progress_cb, **kwargs):

        ...

        task["item"]["other_params"]["my_custom_data"] = the_publish_entity_we_just_created

        ...

     

    # Secondary publish hook:

    def execute(self, tasks, work_template, comment, thumbnail_path, sg_task, primary_task, primary_publish_path, progress_cb, **kwargs):

        ...

        the_primary_publish_entity = primary_task["item"]["other_params"].get("my_custom_data")

        ...

    Thanks

    Alan

  • 0
    Avatar
    Benoit Leveau

    Hi Alan,

    Oh that's great, I didn't know about this. This will make it even cleaner.

    Out of curiosity, I guess it's not possible to pass information to the post_publish hook though?

    Thanks.

    Benoit

     

     

  • 0
    Avatar
    Alan Dann

    It certainly is possible ;)

    I recently added the primary & secondary tasks to the hook interface specifically for this kind of problem:

    # post process hook

    def execute(self, work_template, primary_task, secondary_tasks, progress_cb, **kwargs):

        ...

    Thanks

    Alan

  • 0
    Avatar
    Benoit Leveau

    Oh yes I saw them, but didn't know at the time I could use the other_params. It all fits in nicely then!

    I should have everything then to do what I want.

    Thanks,

    Benoit

Please sign in to leave a comment.