Changeset a5a8ca7 in mainline


Ignore:
Timestamp:
2009-11-25T14:46:24Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
439d036
Parents:
218e50c
Message:

create jobfile in append mode and use locking to fix parallel builds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/jobfile.py

    r218e50c ra5a8ca7  
    3333import sys
    3434import os
     35import fcntl
    3536
    3637def usage(prname):
     
    4950        options = " ".join(sys.argv[4:])
    5051       
    51         if (os.path.isfile(jobfname)):
    52                 jobfile = file(jobfname, "r")
    53                 records = jobfile.read().split("\n")
    54                 jobfile.close()
    55         else:
    56                 records = []
    57        
    58         records.append("{%s},{%s},{%s},{%s}" % (srcfname, objfname, cwd, options))
    59        
    60         jobfile = file(jobfname, "w")
    61         jobfile.write("\n".join(records))
     52        jobfile = file(jobfname, "a")
     53        fcntl.lockf(jobfile, fcntl.LOCK_EX)
     54        jobfile.write("{%s},{%s},{%s},{%s}\n" % (srcfname, objfname, cwd, options))
     55        fcntl.lockf(jobfile, fcntl.LOCK_UN)
    6256        jobfile.close()
    6357
Note: See TracChangeset for help on using the changeset viewer.