Commit Graph
74 Commits
Author SHA1 Message Date
Sybren A. Stüvel 9074421ec3 Shaman server support
The Shaman server is a file storage system that identifies files by
SHA256sum and file length. BAT can send packs there by only uploading
changed/new files. The BAT pack is reproduced at the Shaman server's
checkout directory by creating symlinks to the files in its file
storage.

Retrying sending files:

When we can defer uploading a file (that is, when we have other files to
upload as well, and we could send the current file at a later moment) we
send an `X-Shaman-Can-Defer-Upload: true` header in the file upload
request. In that case, when someone else is already uploading that file,
a `208 Already Reported` response is sent and the connection is closed.
Python's Requests library unfortunately won't give us that response if
we're still streaming the request, and raise a ConnectionError exception
instead. This exception can mean two things:

- If the `X-Shaman-Can-Defer-Upload: true` header was sent: someone else
  is currently uploading that file, so defer it.
- If that header was not sent: that file is already completely uploaded
  and does not need to be uploaded again.

Instead of retrying each failed file, after a few failures we now just
resend the definition file to get a new list of files to upload, then
send those. This should considerably reduce the number of HTTP calls
when multiple clients are uploading the same set of files.
2019-03-01 14:07:24 +01:00
Sybren A. Stüvel 03fb4da583 Convert target path from Path to str & PurePath
The target path is just read as string from the CLI now, to allow more
complex targets (such as URLs) that don't directly map to a path.

The Packer subclass now handles the conversion from that string to a
`pathlib.PurePath`, and specific subclasses & transfer classes can convert
those to a `pathlib.Path` to perform actual filesystem operations when
necessary.
2019-02-26 16:35:08 +01:00
Sybren A. Stüvel bf7d2b1e27 Added some more unit tests for BlendPath 2019-02-04 15:42:40 +01:00
Sybren A. Stüvel f7fb4b13ca Test packing a blend file with Windows relative paths 2019-01-02 15:41:56 +01:00
Sybren A. Stüvel b79a5dc491 Avoid repeating/constructing the same path 2019-01-02 15:39:09 +01:00
Sybren A. Stüvel 7df73d6c69 Configure test logging at import time (rather than at setup time) 2019-01-02 15:38:34 +01:00
Sybren A. Stüvel 5a41167a09 Missing test teardowns
This kept a file pointer open while trying to delete the file.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel d81fe590db BlendPath: don't use os.path.join() for slash notations
The BlendPath should just use forward slashes, and not be depending on the
current platform.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel 5635895d0c Attempt at making BAT work on Windows
All BlendPath instances will use forward slashes, and there should be
more use of PurePosixPath instead of Path.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel c331b99dc6 Fixed leaking file descriptors in unit tests
These weren't any issue in Linux, but Windows doesn't like it when you
try to delete a still-opened file.
2018-12-20 14:04:23 +01:00
Sybren A. Stüvel 37ad8f8dfc Added --relative-only option to bat pack command
This makes BAT skip assets that are referred to with an absolute path.
It is assumed that the receiver of the BAT pack can access those assets
at the same path.
2018-12-06 10:02:14 +01:00
Sybren A. Stüvel 521c7e1916 Added --compress option for 'bat pack' command
This compresses all packed Blend files. Other files, as well as already-
compressed Blend files, are left as-is.
2018-11-27 14:29:37 +01:00
Sybren A. Stüvel 0b5e034a92 Fix MyPy errors when running without boto3 installed 2018-11-07 13:03:07 +01:00
Philipp Oeser 4e1c2d1bbb Fix T55542: BAT doesn't pack smoke cache 2018-07-06 11:01:44 +02:00
Sybren A. Stüvel 0b96635953 Fix T55539: BAT doesn't pack particle caches 2018-07-03 15:05:15 +02:00
Sybren A. Stüvel aa8e2a8cdd Tracer fix for T55539
This only fixes the tracer; the problem with the packer still exists.
2018-07-03 15:05:15 +02:00
Sybren A. Stüvel f75f35ae77 Swap 'expected' and 'actual' arguments
Python itself doesn't make any distinction (it just logs 'a != b') but
PyCharm does.
2018-07-03 14:30:59 +02:00
Sybren A. Stüvel dfa07e19cc Fix T55007: Support fluid simulation cache files
This also adds support for entire directory paths to be assets, in
addition to globs and numbered file sequences.
2018-06-05 15:12:10 +02:00
Sybren A. Stüvel 8d1bd89583 Allow packing to ZIP files 2018-03-22 10:06:48 +01:00
Sybren A. Stüvel e53470d898 Add a pack-info.txt file at the top of the BAT Pack
This file explains which blend file this pack was created for.
2018-03-21 16:33:41 +01:00
Sybren A. Stüvel f7150c0d29 Allow aborting a pack operation.
For this to work well I also had to remove the sorting of blocks in
trace.deps(). The sorting caused the first `yield` to be executed only
after each blend file was opened, which means that the consuming for-loop
takes a long time to hit its first iteration. As a result, it would respond
slowly to abort requests. By not sorting the first `yield` is much sooner,
resolving this issue.
2018-03-16 12:12:15 +01:00
Sybren A. Stüvel 889f3abd25 Implemented reporting callbacks.
Both the dependency Tracer class and the Packer class now support a
callback object, where the latter is a subclass of the former.

For file transfers running in a separate thread, there is a thread-safe
wrapper for progress callbacks. This wrapper can be called from any thread,
and calls the wrapped callback object from the main thread. This way the
callback implementation itself doesn't have to worry about threading
issues.
2018-03-15 17:59:55 +01:00
Sybren A. Stüvel 59189aab5f Removed unused imports 2018-03-15 14:30:46 +01:00
Sybren A. Stüvel 6b51183095 Packer: store the output path of the blend file in the target directory
This allows the Flamenco Add-on to get the final path of the blend file.
2018-03-14 16:06:21 +01:00
Sybren A. Stüvel 8340df129d BAT Pack can now exclude files based on glob patterns 2018-03-14 16:06:21 +01:00
Sybren A. Stüvel 0e9de7753c Allow Packer to be used as context manager + test for rewriting img seqs 2018-03-14 12:50:27 +01:00
Sybren A. Stüvel d2ac0fa919 Added test for Packer.close() 2018-03-14 12:30:18 +01:00
Sybren A. Stüvel c9664ca045 Report missing files in Packer.strategise() 2018-03-14 12:24:26 +01:00
Sybren A. Stüvel ef5c46eba5 Some mypy & test tweaks 2018-03-09 16:29:30 +01:00
Sybren A. Stüvel 4c3d288be9 Add mypy invocation to unit test
This way it's easy to run both the tests and mypy.
2018-03-09 14:24:06 +01:00
Sybren A. Stüvel 824ca4bcb7 Rewrite blend files in temporary directory, before copying
This allows us to later support uploading to a non-local filesystem, such
as Amazon S3 cloud storage, after path rewriting is complete.
2018-03-09 12:33:15 +01:00
Sybren A. Stüvel 384f1d5107 Compare float with assertAlmostEqual 2018-03-09 11:20:38 +01:00
Sybren A. Stüvel 632d01334c Renamed module tracer → trace
This is consistent with the other module names.
2018-03-09 10:02:44 +01:00
Sybren A. Stüvel e8f41f2735 Store rewrites in AssetAction
This is in preparation of interchanging copying and rewriting.
2018-03-09 10:00:46 +01:00
Sybren A. Stüvel 0dab872289 Truncate UTF-8 in a way that produces valid UTF-8. 2018-03-08 14:47:41 +01:00
Sybren A. Stüvel e9ee5b69ec Disallow BlendPath(str) 2018-03-08 14:18:07 +01:00
Sybren A. Stüvel 88f23a4097 Also test bat pack --noop 2018-03-08 13:02:18 +01:00
Sybren A. Stüvel 0df94c74cd Also test Packer.execute() 2018-03-08 12:41:19 +01:00
Sybren A. Stüvel b5418e1f5f Removed Packer._packed_paths
The info in that dict is also available in Packer._actions[...].new_path
2018-03-08 11:15:38 +01:00
Sybren A. Stüvel 01a9392fc1 Added unit test for Packer.strategise() 2018-03-08 11:00:02 +01:00
Sybren A. Stüvel ccdccd69cf Speed up rewriting paths by reusing cached DNA structs & blocks 2018-03-08 10:59:45 +01:00
Sybren A. Stüvel e2123f8090 Path rewriting for sequences seems to be working too. 2018-03-06 16:41:16 +01:00
Sybren A. Stüvel 71dd5bc11b Path rewriting when packing.
Doesn't work with sequences, nor with split dirname/basename fields.
2018-03-06 16:06:36 +01:00
Sybren A. Stüvel 92f91b42cf Added test case for Windows-style paths 2018-03-06 11:45:35 +01:00
Sybren A. Stüvel 8009ff1e47 Added block expansion
The expansion process follows pointers and library links to construct
the full set of actually-used data blocks. This set consists of all data
blocks in the initial blend file, and all *actually linked-to* data
blocks in linked blend files.

I've also removed non-recursive dependency listing.
2018-03-02 15:44:07 +01:00
Sybren A. Stüvel 7167d51730 Added BlendFileBlock.id_name property
Evaluated only once, so safe to call multiple times without producing
excessive disk I/O. Returns None instead of raising KeyError when there is
no (b'id', b'name') field.
2018-03-02 11:26:02 +01:00
Sybren A. Stüvel f46e761f09 Removed base_index parameter in favour of explicit array handling
The `base_index` parameter is confusing and only works in a limited number
of cases. Having explicit functions to deal with those cases is preferred.
2018-03-01 12:50:22 +01:00
Sybren A. Stüvel 55302004ee Test BlockUsage.files() 2018-02-28 16:51:27 +01:00
Sybren A. Stüvel ca964181fe Beginning of CLI interface + protection against infinite recursion. 2018-02-28 16:47:13 +01:00
Sybren A. Stüvel 8ae400acbe Support particle simulation point cache data
Also see https://developer.blender.org/T53562
2018-02-28 14:11:48 +01:00