Skip to content

Commit

Permalink
Merge pull request #7677 from jonboiser/merge-gh-action-update
Browse files Browse the repository at this point in the history
Merge GH action config updates to `develop` + fix undefined ref in `AuthBase.vue`
  • Loading branch information
rtibbles committed Nov 9, 2020
2 parents 032aa22 + faa47ef commit c9cd656
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn --frozen-lockfile
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-tox-py${{ matrix.python-version }}
- name: Test with tox
run: tox -e py${{ matrix.python-version }}
- name: Upload coverage to Codecov
Expand Down Expand Up @@ -77,8 +75,6 @@ jobs:
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-tox-py${{ matrix.python-version }}
- name: Test with tox
run: tox -e postgres
- name: Upload coverage to Codecov
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn --frozen-lockfile
Expand Down
21 changes: 10 additions & 11 deletions kolibri/core/content/management/commands/importcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,7 @@ def _transfer( # noqa: max-complexity=16
if len(file_transfers) > 0:
f, filetransfer = file_transfers.pop()
future = executor.submit(
self._start_file_transfer,
f,
filetransfer,
overall_progress_update,
self._start_file_transfer, f, filetransfer
)
future_file_transfers[future] = (f, filetransfer)

Expand All @@ -358,7 +355,8 @@ def _transfer( # noqa: max-complexity=16
):
f, filetransfer = future_file_transfers[future]
try:
status = future.result()
status, data_transferred = future.result()
overall_progress_update(data_transferred)
if self.is_cancelled():
break

Expand Down Expand Up @@ -424,24 +422,25 @@ def _transfer( # noqa: max-complexity=16
if self.is_cancelled():
self.cancel()

def _start_file_transfer(self, f, filetransfer, overall_progress_update):
def _start_file_transfer(self, f, filetransfer):
"""
Start to transfer the file from network/disk to the destination.
Return value:
* FILE_TRANSFERRED - successfully transfer the file.
* FILE_SKIPPED - the file does not exist so it is skipped.
"""
data_transferred = 0

with filetransfer:
for chunk in filetransfer:
length = len(chunk)
overall_progress_update(length)
data_transferred += len(chunk)

# Ensure that if for some reason the total file size for the transfer
# is less than what we have marked in the database that we make up
# the difference so that the overall progress is never incorrect.
# This could happen, for example for a local transfer if a file
# has been replaced or corrupted (which we catch below)
overall_progress_update(f.file_size - filetransfer.total_size)
data_transferred += f.file_size - filetransfer.total_size

# If checksum of the destination file is different from the localfile
# id indicated in the database, it means that the destination file
Expand All @@ -452,9 +451,9 @@ def _start_file_transfer(self, f, filetransfer, overall_progress_update):
e = "File {} is corrupted.".format(filetransfer.source)
logger.error("An error occurred during content import: {}".format(e))
os.remove(filetransfer.dest)
return FILE_SKIPPED
return FILE_SKIPPED, data_transferred

return FILE_TRANSFERRED
return FILE_TRANSFERRED, data_transferred

def handle_async(self, *args, **options):
if options["command"] == "network":
Expand Down
3 changes: 1 addition & 2 deletions kolibri/core/content/test/test_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@ def test_local_import_source_corrupted_full_progress(
local_src_path = tempfile.mkstemp()[1]
with open(local_src_path, "w") as f:
f.write("This is just a test")
src_file_size = os.path.getsize(local_src_path)
expected_file_size = 10000
local_dest_path = tempfile.mkstemp()[1]
os.remove(local_dest_path)
Expand Down Expand Up @@ -798,7 +797,7 @@ def test_local_import_source_corrupted_full_progress(
node_ids=["32a941fb77c2576e8f6b294cde4c3b0c"],
)

mock_overall_progress.assert_any_call(expected_file_size - src_file_size)
mock_overall_progress.assert_any_call(expected_file_size)

@patch(
"kolibri.core.content.management.commands.importcontent.transfer.FileDownload.finalize"
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/user/assets/src/views/AuthBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<p v-if="!hideCreateAccount && canSignUp" class="create">
<KRouterLink
:text="AuthSelectStrings.$tr('createAccountAction')"
:text="userString('createAccountAction')"
:to="signUpPage"
:primary="false"
appearance="raised-button"
Expand Down

0 comments on commit c9cd656

Please sign in to comment.