| 1 |
Assets |
| 2 |
====== |
| 3 |
|
| 4 |
This directory contains tooling for managing assets used by the bots. The |
| 5 |
primary entry point is assets.py, which allows a user to add, remove, upload, |
| 6 |
and download assets. |
| 7 |
|
| 8 |
Assets are stored in Google Storage, named for their version number. |
| 9 |
|
| 10 |
|
| 11 |
Individual Assets |
| 12 |
----------------- |
| 13 |
|
| 14 |
Each asset has its own subdirectory with the following contents: |
| 15 |
* VERSION: The current version number of the asset. |
| 16 |
* [optional] create.py: Script which creates the asset, implemented by the user and called by `sk asset upload`. |
| 17 |
* [optional] create\_and\_upload.py: User-implemented convenience script which wraps `sk asset upload` in whatever way makes sense for the asset. |
| 18 |
|
| 19 |
|
| 20 |
Examples |
| 21 |
------- |
| 22 |
|
| 23 |
As with all uses of `sk asset`, the following will only work if you have a |
| 24 |
google.com account and have authenticated with |
| 25 |
`gcloud auth application-default login`. |
| 26 |
|
| 27 |
Add a new asset and upload an initial version. |
| 28 |
|
| 29 |
``` |
| 30 |
$ sk asset add myasset |
| 31 |
Do you want to add a creation script for this asset? (y/n): n |
| 32 |
$ sk asset upload --in ${MY_ASSET_LOCATION} myasset |
| 33 |
$ git commit |
| 34 |
``` |
| 35 |
|
| 36 |
Add an asset whose creation can be automated. |
| 37 |
|
| 38 |
``` |
| 39 |
$ sk asset add myasset |
| 40 |
Do you want to add a creation script for this asset? (y/n): y |
| 41 |
Created infra/bots/assets/myasset/create.py; you will need to add implementation before uploading the asset. |
| 42 |
$ vi infra/bots/assets/myasset/create.py |
| 43 |
(implement the create_asset function) |
| 44 |
$ sk asset upload myasset |
| 45 |
$ git commit |
| 46 |
``` |
| 47 |
|
| 48 |
Update an asset. |
| 49 |
|
| 50 |
``` |
| 51 |
(update the create.py script) |
| 52 |
$ sk asset upload myasset |
| 53 |
(assuming infra/bots/assets/myasset/VERSION has been updated by the previous |
| 54 |
command, regenerate tasks.json per infra/bots/README:) |
| 55 |
$ make -C infra/bots train |
| 56 |
$ git commit |
| 57 |
``` |