FAQ
Hello,

Is it possible to report some sort of status or progress for a long running
minion job? Basically I have a small API running on the salt-master
server. One of the functions of this api is to upload a python script to
a salt-minion and then execute that script. It does this by creating an
async salt job, and periodically checking if it is finished yet.

The problem is that sometimes this script can take 30 minutes to an hour to
complete, but we have no idea how far along it is without logging directly
into the minion to check. We do periodically print out the status of the
script to a log file on the minion. Once the script finishes, salt will
return the results we expect so we at least know it's finished.

Does anyone have an idea on how to report some sort of progress while the
script is running? I'd even be happy with salt returning the stdout of
the script every time it checks for a result, but I don't think that is
possible at the moment.

My current idea is to just use cmd.run 'tail -n 5 /root/scriptlog.log' and
returning that to our web UI that triggers everything, but it seems like
there should be an easier way to do it.

Thanks,

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Viq at Jul 3, 2015 at 7:09 am
    You could have the script fire events on the event bus and look for those,
    maybe using salt-eventsd to help with that.
    On 3 Jul 2015 00:07, "Justyn Shull" wrote:

    Hello,

    Is it possible to report some sort of status or progress for a long
    running minion job? Basically I have a small API running on the
    salt-master server. One of the functions of this api is to upload a
    python script to a salt-minion and then execute that script. It does this
    by creating an async salt job, and periodically checking if it is finished
    yet.

    The problem is that sometimes this script can take 30 minutes to an hour
    to complete, but we have no idea how far along it is without logging
    directly into the minion to check. We do periodically print out the
    status of the script to a log file on the minion. Once the script
    finishes, salt will return the results we expect so we at least know it's
    finished.

    Does anyone have an idea on how to report some sort of progress while the
    script is running? I'd even be happy with salt returning the stdout of
    the script every time it checks for a result, but I don't think that is
    possible at the moment.

    My current idea is to just use cmd.run 'tail -n 5 /root/scriptlog.log' and
    returning that to our web UI that triggers everything, but it seems like
    there should be an easier way to do it.

    Thanks,

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colton Myers at Jul 14, 2015 at 10:42 pm
    Yep, I would recommend using the event bus. You can fire events using
    `salt-call event.send`. Then on the master side you can monitor for those
    events using `salt-run state.event tagmatch=<glob pattern for tag>`. Then
    it will show all events that match the glob pattern in their tag, so you
    can monitor for the specific events your long job is generating, and see
    where in the process it is.

    Hope that helps!

    --
    Colton Myers
    Platform Engineer, SaltStack
    @basepi on Twitter/Github/IRC
    On Fri, Jul 3, 2015 at 1:09 AM, viq wrote:

    You could have the script fire events on the event bus and look for those,
    maybe using salt-eventsd to help with that.
    On 3 Jul 2015 00:07, "Justyn Shull" wrote:

    Hello,

    Is it possible to report some sort of status or progress for a long
    running minion job? Basically I have a small API running on the
    salt-master server. One of the functions of this api is to upload a
    python script to a salt-minion and then execute that script. It does this
    by creating an async salt job, and periodically checking if it is finished
    yet.

    The problem is that sometimes this script can take 30 minutes to an hour
    to complete, but we have no idea how far along it is without logging
    directly into the minion to check. We do periodically print out the
    status of the script to a log file on the minion. Once the script
    finishes, salt will return the results we expect so we at least know it's
    finished.

    Does anyone have an idea on how to report some sort of progress while the
    script is running? I'd even be happy with salt returning the stdout of
    the script every time it checks for a result, but I don't think that is
    possible at the moment.

    My current idea is to just use cmd.run 'tail -n 5 /root/scriptlog.log'
    and returning that to our web UI that triggers everything, but it seems
    like there should be an easier way to do it.

    Thanks,

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedJul 2, '15 at 10:07p
activeJul 14, '15 at 10:42p
posts3
users3

3 users in discussion

Colton Myers: 1 post Viq: 1 post Justyn Shull: 1 post

People

Translate

site design / logo © 2022 Grokbase