25 Commits

Author SHA1 Message Date
Sybren A. Stüvel
b22b9da5d0 Shaman: Moved URL parsing into a separate function
This allows other code to just call that function, rather than copying
the behaviour.
2019-03-01 14:07:24 +01:00
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
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
b6c0d01e45 bat pack --help improvements 2018-11-27 14:37:15 +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
8d1bd89583 Allow packing to ZIP files 2018-03-22 10:06:48 +01:00
Sybren A. Stüvel
cd32442f5a Fixed issues with relative paths to blend files 2018-03-20 17:57:41 +01:00
Sybren A. Stüvel
56fb89da3d S3Packer now takes a URL as endpoint, not a hostname 2018-03-20 16:36:29 +01:00
Sybren A. Stüvel
53e22a4a2f Added GPL comment blocks with proper attibution. 2018-03-16 13:25:20 +01:00
Sybren A. Stüvel
73b264f6bc Allow relative project path 2018-03-14 16:06:21 +01:00
Sybren A. Stüvel
9ceb42af2f Moved some code into its own function 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
ea832cd666 Added support for uploads to S3 by using the boto3 client. 2018-03-09 16:48:34 +01:00
Sybren A. Stüvel
0778b3a6ec Defined file transferer abstract base class
This will allow for different file transfer classes uploading to different
services.
2018-03-09 13:04:14 +01:00
Sybren A. Stüvel
ac3f6142b3 Move rewritten blend files instead of copying them
This will cause a nice speedup if the temporary directory happens to be on
the same file system as the target directory for the BAT Pack. This can be
influenced by setting an environment variable; see the documentation for
[tempfile.gettempdir](https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir)
2018-03-09 12:47:50 +01:00
Sybren A. Stüvel
fdbbc3a20d Static type checking with mypy
This does introduce some not-so-nice things, like having to annotate each
`__init__` function with `-> None`. However, the benefits of having static
type checking in a complex bit of software like BAT outweigh the downsides.
2018-03-09 11:09:47 +01:00
Sybren A. Stüvel
898f79a951 Removed unused imports 2018-03-08 14:35:35 +01:00
Sybren A. Stüvel
c80bb8232e Fix bad reference 2018-03-08 14:27:17 +01:00
Sybren A. Stüvel
08f538d8c8 File I/O improvements
- Tracer now iterates over blocks in disk order.
- Packer copies files per directory, in a separate thread.
- Packer only copies files if they don't exist yet.
- Packer also copies file permissions.
2018-03-08 12:33:15 +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
433ad8f16a Moved packer code into separate class, in preparation for smarter behaviour 2018-03-06 11:58:38 +01:00
Sybren A. Stüvel
39474548d2 Pack: Made project path explicit 2018-03-06 11:41:28 +01:00
Sybren A. Stüvel
5c8e074c68 Implemented simple 'bat pack' CLI command
No path rewriting yet, just simply copying the dependencies. They are
copied to the target directory + the path relative to the current working
directory. For example:

bat pack scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend /tmp/packer

will write to
/tmp/packer/scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend
and will copy ./path/to/file → /tmp/packer/path/to/file
2018-03-02 17:59:04 +01:00
Sybren A. Stüvel
ca964181fe Beginning of CLI interface + protection against infinite recursion. 2018-02-28 16:47:13 +01:00