[Scons-users] parallel invocation of SCons
Jason Kenny
dragon512 at live.com
Thu Feb 14 10:06:14 EST 2019
Hi,
As I understand it, Scons will write most of the data at the end of the run. There is a race as it will write out the whole file with updated state from the current run. This leads to the race issue you are seeing as the state of one run will replace the data from a previous run, leading to bad states. I normally work around this via one of two ways:
1) run scons with two targets and a -j[n] option. This case normally solves the issue for me. it can however be hard to read output, or from your CI point of view not break up the tasks as you might like.
2) use the SConsignFile() in your different runs to use different DB files so there is no conflicts. This case may allow you to work around your issue as you can prevent the race condition on a common file.
Information about the SConsignFile below.
Jason
SConsignFile([file, dbm_module]) , env.SConsignFile([file, dbm_module])
This tells scons to store all file signatures in the specified database file. If the file name is omitted, .sconsign is used by default. (The actual file name(s) stored on disk may have an appropriated suffix appended by the dbm_module.) If file is not an absolute path name, the file is placed in the same directory as the top-level SConstruct file.
If file is None, then scons will store file signatures in a separate .sconsign file in each directory, not in one global database file. (This was the default behavior prior to SCons 0.96.91 and 0.97.)
The optional dbm_module argument can be used to specify which Python database module The default is to use a custom SCons.dblite module that uses pickled Python data structures, and which works on all Python versions.
Examples:
# Explicitly stores signatures in ".sconsign.dblite"
# in the top-level SConstruct directory (the
# default behavior).
SConsignFile()
# Stores signatures in the file "etc/scons-signatures"
# relative to the top-level SConstruct directory.
SConsignFile("etc/scons-signatures")
# Stores signatures in the specified absolute file name.
SConsignFile("/home/me/SCons/signatures")
# Stores signatures in a separate .sconsign file
# in each directory.
SConsignFile(None)
________________________________
From: Scons-users <scons-users-bounces at scons.org> on behalf of Herzog, Tobias (CQSP) <tobias.herzog at carmeq.com>
Sent: Thursday, February 14, 2019 3:14 AM
To: Scons-users at scons.org
Subject: [Scons-users] parallel invocation of SCons
Hi SCons users,
due to a parallelization in a CI build pipeline, I have the use case, that SCons (possibly) is invoked concurrently in the same tree (i.e. using database) but with different build targets. I already noticed, that this can lead to a crashing SCons and/or corrupted database.
For me it would be sufficient, if SCons just waits until the other SCons process has finished. My Idea was, to acquire any kind of inter process lock right in the SConstruct, that is active until the process terminates. So my assumption here is, that database access takes place after the reading of SConstruct/SConscript is done.
Is this correct? Will this solution be safe? Has anyone solved this problem in another/better way?
Thanks an best regards,
Tobias
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190214/d7a97595/attachment.html>
More information about the Scons-users
mailing list