How to check for when a publishing job is complete

I am automating the publication of several language outputs. I need to know when the publishing job is complete, so I can start the next publishing job. The sample code from an ISHRemote webinar handles this with Start-Sleep like this:

$ishObject = Publish-IshPublicationOutput -IshSession $ishSession -LogicalId $guid -Version 2 -LanguageCombination "en-us" -OutputFormat "PDF (XPP A4)"

Start-Sleep -Seconds 60

This works, but it's not very flexible for when there are longer publishing jobs, etc. What is a good way to check for publication status in real time? I notice that getting the publication object in a variable $publication like below is static and does not update in real time:

$publication = Get-IshPublicationOutput -LogicalId $PubGuid

$publication[1].fishpubstatus

I had the idea of getting the publication newly again every 10 seconds or so, and then checking on fishpubstatus. Is there a better way to go?

Thanks, Mark

Parents
  • That the object in the variable does not refresh is part of the programing model, only the cmdlets will go to the server API to execute/refresh material.

    The question can already be solved using the current cmdlets, there is an idea for a shorthand cmdlet on Add cmdlet Wait-IshPublicationOutput · Issue #72 · RWS/ISHRemote Give that one a thumbs up to help order the backlog. The key problem that the cmdlet would try to solve is to know how often a status-update polling should happen... every 10 seconds will just flood the server if your information architecture already knows it will take 3+ hours or 12+ hours.

    However you probably know roughly how long it will take in your environment, for your chosen OutputFormat...

    I would also reference (+) Publishing APIs help - 01 - General Discussion Forum - Tridion Docs - RWS Community as an interesting read for you.

    -Dave

  • Thanks Dave, this is all useful.

    What does $ishobject = $ishobject do? From looking at the code it seems like it is supposed to update the publish object so you can get a new read on $ishobject.fishpubstatus_lng_element. But I tried it manually a few times and it seems to remain static. As the publshing was happening, the value remained at VPUBSTATUSPUBLISHPENDING and never went to VPUBSTATUSUNPUBLISHING.

  • Missed this one... the below including the pipe and extra cmdlet says to offer $ishobject as input to Get-IshPublicationOutput which in turn will return a refreshed $ishobject

    $ishobject = $ishobject | Get-IshPublicationOutput

    An even slightly more optimal way of writing this is

    $ishobject = Get-IshPublicationOutput -IshObject $ishobject

Reply Children
No Data