Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-video-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-video-pipeline
Commits
6023feb1
Unverified
Commit
6023feb1
authored
May 21, 2018
by
Simon Chen
Committed by
GitHub
May 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #106 from edx/schen/reingest
Add the management command of re-ingest_from_hotstore
parents
e531bd09
093be18e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
VEDA_OS01/management/commands/re_ingest_from_hotstore.py
+62
-0
No files found.
VEDA_OS01/management/commands/re_ingest_from_hotstore.py
0 → 100644
View file @
6023feb1
"""
Management command used to re-ingest video from hotstore based on the params provided.
"""
import
logging
import
boto
import
boto.s3
import
os
import
subprocess
from
django.core.management.base
import
BaseCommand
from
VEDA_OS01.models
import
Video
from
control.veda_file_discovery
import
FileDiscovery
try
:
boto
.
config
.
add_section
(
'Boto'
)
except
:
pass
LOGGER
=
logging
.
getLogger
(
__name__
)
BUCKET_NAME
=
'veda-hotstore'
class
Command
(
BaseCommand
):
"""
Re-ingest video from hotstore command class
"""
help
=
'Re-ingest video from in VEDA S3 bucket (hotstore)'
def
add_arguments
(
self
,
parser
):
super
(
Command
,
self
)
.
add_arguments
(
parser
)
# Required positional arguments.
parser
.
add_argument
(
'start_video_id'
,
help
=
"The smaller video id for the list"
)
parser
.
add_argument
(
'end_video_id'
,
help
=
"The bigger video id for the list"
)
def
handle
(
self
,
*
args
,
**
options
):
"""
handle method for command class.
"""
LOGGER
.
info
(
'[Re-ingest from hotstore] Process started.'
)
start_id
=
options
.
get
(
'start_video_id'
)
end_id
=
options
.
get
(
'end_video_id'
)
query
=
Video
.
objects
.
filter
(
id__range
=
(
start_id
,
end_id
))
conn
=
boto
.
connect_s3
()
bucket
=
conn
.
get_bucket
(
BUCKET_NAME
)
for
vd
in
query
:
keyname
=
vd
.
edx_id
+
'.'
+
vd
.
video_orig_extension
filename
=
'./'
+
keyname
vd_key
=
bucket
.
get_key
(
keyname
)
file_discovery
=
FileDiscovery
()
file_discovery
.
validate_metadata_and_feed_to_ingest
(
vd_key
)
LOGGER
.
info
(
'Ingest completed for {}'
.
format
(
vd
.
edx_id
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment