Guard against concurrent invocations of hydra-queue-runner

[?]
Jun 22, 2015, 12:24 PM
K5G5GZY7D7KWVR5RAGZFHH3ZPG5OCLZT4HZ6XIJJ7YYVUMC2CTZQC

Dependencies

  • [2] PLOZBRTR Add command ‘hydra-queue-runner --status’ to show current status
  • [*] 24BMQDZA Start of single-process hydra-queue-runner
  • [*] GS4BE6TB Asynchronously compress build logs
  • [*] NJJ7H64S Very basic multi-threaded queue runner

Change contents

  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 29
    [2.28]
    [4.5036]
    #include "pathlocks.hh"
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 310
    [5.1020]
    [2.96]
    /* Acquire the global queue runner lock, or null if somebody else
    has it. */
    std::shared_ptr<PathLocks> acquireGlobalLock();
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 1401
    [5.3005]
    [5.3005]
    }
    std::shared_ptr<PathLocks> State::acquireGlobalLock()
    {
    Path lockPath = hydraData + "/queue-runner";
    auto lock = std::make_shared<PathLocks>();
    if (!lock->lockPaths(PathSet({lockPath}), "", false)) return 0;
    return lock;
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 1524
    [2.3568]
    [2.3568]
    auto lock = acquireGlobalLock();
    if (!lock)
    throw Error("hydra-queue-runner is currently running");
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 1542
    [6.3200]
    [2.3753]
    auto lock = acquireGlobalLock();
    if (!lock)
    throw Error("hydra-queue-runner is already running");