Skip to content

Commit

Permalink
global: pin flower version
Browse files Browse the repository at this point in the history
* fix tests
  • Loading branch information
kpsherva authored and zzacharo committed Jan 10, 2022
1 parent 6e33754 commit a3bd3b7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
9 changes: 5 additions & 4 deletions cds/modules/deposit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ def _merge_related_objects(self, record_id, snapshot, data):
"""."""
# dict of version_ids in original bucket to version_ids in
# snapshot bucket for the each file
#import ipdb;ipdb.set_trace()
snapshot_obj_list = ObjectVersion.get_by_bucket(bucket=snapshot)
old_to_new_version = {
str(self.files[obj.key]['version_id']): str(obj.version_id)
Expand All @@ -386,7 +385,6 @@ def _merge_related_objects(self, record_id, snapshot, data):

# Generate SMIL file
data['_files'] = self.files.dumps(bucket=snapshot.id)
#import ipdb;ipdb.set_trace()
master_video = get_master_object(snapshot)
if master_video:
from cds.modules.records.serializers.smil import generate_smil_file
Expand Down Expand Up @@ -436,8 +434,11 @@ def is_deposit(url):
def get_master_object(bucket):
"""Get master ObjectVersion from a bucket."""
# TODO do as we do in `get_master_video_file()`?
#import ipdb;ipdb.set_trace()
return ObjectVersion.get_by_bucket(bucket).join(ObjectVersionTag).filter(ObjectVersionTag.key == 'context_type',ObjectVersionTag.value == 'master').one_or_none()
return ObjectVersion.get_by_bucket(bucket).join(ObjectVersionTag)\
.filter(
ObjectVersionTag.key == 'context_type',
ObjectVersionTag.value == 'master')\
.one_or_none()


def is_project_record(record):
Expand Down
2 changes: 1 addition & 1 deletion cds/modules/flows/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def delete(self):
"""Mark the flow as deleted."""
self.clean()
self.deleted = True
print("RUNNING DELETE")
db.session.commit()

@staticmethod
Expand All @@ -382,6 +381,7 @@ def stop(self):

def clean(self):
"""Delete tasks and everything created by them."""
print("RUN CLEAN TASKS")
self.clean_task(task_name='file_video_extract_frames')
for preset_quality in get_all_distinct_qualities():
self.clean_task(
Expand Down
3 changes: 0 additions & 3 deletions cds/modules/flows/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def init_object_version(flow):
flow_id = str(flow.id)
with db.session.begin_nested():
# create a object version if doesn't exists
# import ipdb;
# ipdb.set_trace()
if flow.payload.get('version_id'):
version_id = flow.payload['version_id']
object_version = as_object_version(version_id)
Expand All @@ -58,7 +56,6 @@ def init_object_version(flow):
ObjectVersionTag.create_or_update(
object_version, 'media_type', 'video'
)
#import ipdb;ipdb.set_trace()
ObjectVersionTag.create_or_update(
object_version, 'context_type', 'master'
)
Expand Down
1 change: 0 additions & 1 deletion cds/modules/flows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def post(self, user_id):
assert data["deposit_id"]
assert data.get("version_id") or data.get("uri")
assert data["key"]
#import ipdb;ipdb.set_trace()
new_flow = Flow(deposit_id=data["deposit_id"],
user_id=user_id,
payload=dict(
Expand Down
2 changes: 1 addition & 1 deletion docker-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ services:
- "9200:9200"
- "9300:9300"
flower:
image: mher/flower
image: mher/flower:0.9.7
command: --broker=amqp://guest:guest@mq:5672/ --broker_api=http://guest:guest@mq:15672/api/
ports:
- "5555:5555"
2 changes: 2 additions & 0 deletions tests/unit/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,11 @@ def get_encoding_status(self, job_id):
def mock_compute_status(cls, statuses):
return Status.FAILURE


def mock_compute_status(cls, statuses):
return Status.FAILURE


def mock_build_flow_status_json(flow_json):
"""Build serialized status object."""
status = ([], [])
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_webhook_receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def load_email(sender, identity):
api_app.test_client() as client:
resp = client.delete(url, headers=json_headers)

assert resp.status_code == 410
assert resp.status_code == 200

# check that object versions and tags are deleted
# (Create + Delete) * Num Objs
Expand Down Expand Up @@ -358,7 +358,7 @@ def test_avc_workflow_receiver_local_file_pass(
# [[ DELETE WORKFLOW ]]
resp = client.delete(url, headers=json_headers)

assert resp.status_code == 410
assert resp.status_code == 200

# check that object versions and tags are deleted
# (Create + Delete) * Num Objs - 1 (because the file is local and will
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_webhook_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def test_webhooks_reload_master(api_app, users, access_token, json_headers,
flow_id=str(flow_id),
access_token=access_token)
resp = client.delete(url_delete, headers=json_headers)

payload["key"] = resp.get_json()["key"]
# run the workflow!
resp = client.post(url_run_workflow, headers=json_headers,
data=json.dumps(payload))
Expand Down

0 comments on commit a3bd3b7

Please sign in to comment.