Don't fail the sync completely when a remote file does not exist.

This commit is contained in:
Dan 2021-05-05 15:59:00 -04:00
parent 8f28970f92
commit 7831bef050
2 changed files with 7 additions and 4 deletions

View File

@ -184,9 +184,12 @@ def update_or_create_current_file(remote,workflow_spec_id,updatefile):
currentfile.content_type = updatefile['content_type']
currentfile.primary_process_id = updatefile['primary_process_id']
session.add(currentfile)
try:
content = WorkflowSyncService.get_remote_file_by_hash(remote, updatefile['md5_hash'])
FileService.update_file(currentfile, content, updatefile['type'])
except ApiError:
# Remote files doesn't exist, don't update it.
print("Remote file " + currentfile.name + " does not exist, so not syncing.")
def sync_changed_files(remote,workflow_spec_id):
"""

View File

@ -47,6 +47,6 @@ class WorkflowSyncService(object):
return json.loads(response.text)
else:
raise ApiError("workflow_sync_error",
"Received an invalid response from the protocol builder (status %s): %s when calling "
"Received an invalid response from the remote CR-Connect API (status %s): %s when calling "
"url '%s'." %
(response.status_code, response.text, url))