Commit Graph

717 Commits (04d8d383f313f41f3a957591247b9fb982e2ba47)
 

Author SHA1 Message Date
Mike Lang 29040a166c backfiller: Allow multiple concurrent segment downloads
This will signifigantly increase throughput when downloading
large ranges of segments.

The max concurrency is exposed as a cli arg.

We also slightly modify the logged info, so it reports segments downloaded,
not just number of missing segments (which we might skip downloading for various reasons).
5 years ago
Christopher Usher ec5a545fd2 Merge branch 'mike/sheetsync/fix-db-error' 5 years ago
Mike Lang 7273ee071e monitoring fixes 5 years ago
Mike Lang 5a6d443efd grafana: View-only anonymous access 5 years ago
Christopher Usher 980875b6f3 Merge branch 'mike/sheetsync/fix-db-error' of https://github.com/ekimekim/wubloader into mike/sheetsync/fix-db-error 5 years ago
Christopher Usher 37bad7d5ed Also reset database connection on error in the backfiller 5 years ago
Christopher Usher 28f350dd46 Also reset database connection on error in the backfiller 5 years ago
Mike Lang e048db0d94 cutter: Fix a failure mode where we never recover from a DB conn failure in TranscodeChecker
Since we never got a new conn after failure, we would just keep erroring with
"connection already closed" errors.

This isn't applicable to the main cutter loops since a DB failure there will restart the process.
5 years ago
Mike Lang fe68e98804 sheetsync: Fix a failure mode where we never recover from a DB conn failure
Since we never got a new conn after failure, we would just keep erroring with
"connection already closed" errors.
5 years ago
Mike Lang a767760f02 Add some existing scripts for setting up prometheus 5 years ago
Mike Lang 90eb2a4f13
Merge pull request #59 from ekimekim/mike/fixes
Some misc fixes from cutter and backfiller, see commits
5 years ago
Mike Lang 51efeb1f12
Merge pull request #58 from ekimekim/mike/nginx-dns-hack
Fix nginx when some services are disabled
5 years ago
Mike Lang 7179fcacec Backfiller: ignore temp segments
To make this work, we make type a proper segment field.

We also tell get_best_segments to ignore temp segments, since they might go away
before we can actually use them.
5 years ago
Mike Lang 85c110ccb4 cutter: Fix typo from when we moved to the client model instead of auth headers 5 years ago
Mike Lang 3fa3c73d0e Fix nginx when some services are disabled
nginx tries to resolve everything at startup, which doesn't work
if some of the services aren't present.

we instead generate the config file from a passed in env var, so that only
enabled services are present.
5 years ago
Mike Lang 6d729fa5cc
Merge pull request #57 from ekimekim/mike/compose-bits
Some stuff for making the docker compose setup easier
5 years ago
Mike Lang 6071a2f18d docker_compose: Add a local postgres instance as an optional service
The node hosting the database can then easily run it as part of the stack.
5 years ago
Mike Lang 63eb324ba5 Add nginx service that provides a frontend to all the other services
This allows us to run all the different services and expose all their metrics,
all on one port.
5 years ago
Mike Lang a7a54db726 docker-compose: Restructure for some finer control
Allow enabling/disabling at top of file
Allow no port to be exposed for any service
5 years ago
Mike Lang 499e486b0b
Merge pull request #54 from ekimekim/mike/sheet-sync/initial
sheet sync
5 years ago
Mike Lang 018e920808 sheet-sync: Some fixes 5 years ago
Christopher Usher dd246e1343 ekimekim's suggestions 5 years ago
Christopher Usher 9b28765ff2 Bug fixes to get the database connection working 5 years ago
Christopher Usher 4b9fbcb7d2 backfiller database code 5 years ago
Mike Lang 6c47f32d16 docker-compose.jsonnet: Add sheet sync 5 years ago
Mike Lang f354130434 sheetsync: Only allocate ids when first needed
This prevents rate limiting issues when immediately allocating all 999 ids
for an empty sheet.
5 years ago
Mike Lang 11fc67f071 sheetsync: Review feedback
* Expand on some comments
* Fix conflicting port number
* Write help text for all args
5 years ago
Mike Lang 9762f308a0 Implement main part of sheet sync 5 years ago
Mike Lang 5a44bfdf51 Google sheets api wrapper
Exposes a way to read all rows, and write a single cell.

We need to read all columns of each row so we know what would be modified
so we only do updates to single cells that aren't already the correct value.

This keeps us from impacting the sheet load too much with constantly changing values,
which I think might be a thing even if the values are the same.
5 years ago
Mike Lang 3647d091f8 Move common google api auth functionality into common
So we can reuse it for google sheets
5 years ago
Mike Lang 2b4d2cce90 sheet sync: Basic skeleton 5 years ago
Mike Lang 3ccace2a73 database: Update constraints to allow null edit inputs in state DONE
This allows manual uploads to work without needing to fill all the edit fields
with junk.

We also set a constraint on uploader asserting that any videos from claimed onwards have a known uploader.
Again, an exception is made for DONE to allow manual uploads.
5 years ago
MasterGunner 8a2737cd41
Update SecurityModel.md
Modified the model to place the responsibility for granular permissions on Thrimshim; rather than having a "Role Table" listing which fields can be updated by a user.
5 years ago
MasterGunner ea3010b3cf
Create SecurityModel.md 5 years ago
Mike Lang 33be5a92cb Update docker-compose file for thrimshim and cutter
Also update thrimshim to take db connect args as positional,
for consistency with cutter.
5 years ago
Christopher Usher afdad26a51 More fixes 5 years ago
Christopher Usher c3c75b1e4f manually setting a video link now also its own endpoint 5 years ago
Christopher Usher b7a57d4766 reset is now it's own method 5 years ago
Christopher Usher fe5b10f86b Fixes the state transitions of the trimbleshim to allow video links to be changed or removed 5 years ago
Mike Lang 5c84e8dfab restreamer: Fix wrong name for parse function
derp
5 years ago
Mike Lang cca4d52b7d Don't error when encountering a temp-type segment
These can happen if a downloader or backfiller dies suddenly.
We treat it similarly to partial but lacking any hash.

At some point in the future we should probably have something
to find any temp segments, hash them and rename them to partials.
5 years ago
Mike Lang f8d10dacdf Audit and fix all usage of dateutil
We wrap direct dateutil calls to handle two distinct cases:

* `common.dateutil.parse()`: We want to handle arbitrary timestamps including tz info,
then convert them to UTC.

This is used in HLS parsing, and for command line input for backfiller

* `common.dateutil.parse_utc_only()`: We want to only handle UTC timestamps,
but datetime.strptime isn't flexible enough (eg. can't handle missing fractional component).

This is used for restreamer request params.
5 years ago
Mike Lang 5b2a1ef6b7 cutter: Implement actual cut methods
Each method is fairly complicated, but is self-contained and can be examined independently.

cut_jobs in particular contains several extra helpers and directs control flow
via some iterators. This is unfortunately nessecary due to the requests interface.
6 years ago
Mike Lang ae809c696c cutter: Outline of how main cutter run loop works
This commit only lays out the main loop, showing the high-level flow
and defining shared utilities. This is for clarity.

The actual methods that do the work will be implemented seperately.
6 years ago
Mike Lang 80c1a66aa0 cutter: Implement TranscodeChecker
It runs on an interval, fetching all videos in TRANSCODING from the DB,
checking them against youtube, and then updating any that are done.

It should be noted that youtube somewhat lies about what being "done" means,
but this is a better approximation than nothing.
6 years ago
Mike Lang 3ce8360a1e cutter: Add database manager and connections
One connection each for transcode checker and cutter.
We don't need more than one each since both workers only ever do one thing at once.
6 years ago
Mike Lang fdd245a6d9 cutter: Add lightweight youtube client
Provides basic youtube api calls, and gets passed into both transcode checker and cutter.

The official youtube client library is many orders of magnitude larger and more complicated,
and can't actually do what we want (stream an upload of unknown size).
6 years ago
Mike Lang dfc64481a6 Port existing cutting code from restreamer into common
Note this moves over the 'experimental' cutter and deletes the original cutter
that concatenates entire videos before cutting.
We may eventually want to revive that method if the experimental cutter turns out
to introduce too many issues.

We move most of the code over verbatim, but adjust it such that it acts
as a generic iterator that can be used in a variety of contexts.

Some other changes made during the move include telling ffmpeg to be quieter
(don't output version info and junk, only log if something goes wrong),
and avoiding errors during cleanup.
6 years ago
Mike Lang 3d9ba77745 common: add allow_holes option to get_best_segments() to abort early if holes found
This is a performance optimization, allowing us to fail out early (potentially avoiding a LOT
of work) if we know we're going to reject any result that contains holes.

We add a new exception ContainsHoles that is raised in this condition.
6 years ago
Mike Lang e4b6110fd7 cutter: Add initial outline
The cutter has two jobs:
* To cut videos, taking them through states EDITED -> TRANSCODING
* To monitor TRANSCODING videos for when they're complete

We run these as separate greenlets with their own DB connections,
and if either dies we gracefully shut down the other.
6 years ago