There are packages that do job scheduling, including handling dependencies between jobs and recovery from failures. You might investigate some of them.

A fundamental issue is whether you want the various jobs to be aware of each other, or whether you want the dependencies and coordination to be handled externally, as a job scheduler does.

I would try to avoid polling. It is inefficient and/or introduces latency. If you don't want the package that builds the file to initiate the subsequent jobs when it is done, you might consider having the package that starts that package do so synchronously and run the following jobs when the first one exits.

To determine whether some other process has the file open, I would try to open the file and set an exclusive lock on it. If any other process has it open, the attempt to obtain an exclusive lock will fail. If the other process has an exclusive lock, you might not even be able to open the file.

You say "other jobs". Depending on how they interact, you may have to be careful to avoid deadlock, where every job is waiting on some resource held by some other job and nothing can progress. If each job uses (locks for exclusive access) only one resource at a time, this won't be a problem.


In reply to Re: How to check a files Status? by ig
in thread How to check a files Status? by batcater98

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.