scar icon indicating copy to clipboard operation
scar copied to clipboard

Unmanaged exception in upload_file when attempting to upload non-existent file

Open gmolto opened this issue 6 years ago • 3 comments

Trying to upload a non-existent file through scar put yields the following error:

There was an unmanaged exception in upload_file

while the $HOME/.scar/scar.log file clearly indicates the error:

2018-11-21 17:06:46,225 - root - INFO - SCAR execution finished with errors
FileNotFoundError: [Errno 2] No such file or directory: '../ffmpeg/seq2.avi'
    with open(file_path, mode) as content_file:
  File "/Users/gmolto/Documents/GitHub/grycap/scar/src/utils.py", line 152, in read_file
    kwargs['Body'] = utils.read_file(file_path, 'rb')
  File "/Users/gmolto/Documents/GitHub/grycap/scar/src/providers/aws/s3.py", line 102, in upload_file
    return func(*args, **kwargs)
  File "/Users/gmolto/Documents/GitHub/grycap/scar/src/exceptions.py", line 29, in wrapper
Traceback (most recent call last):
2018-11-21 17:06:46,220 - root - ERROR - [Errno 2] No such file or directory: '../ffmpeg/seq2.avi'

Expected behaviour: Indicate that the file does not exist.

Related to this, it would be convenient to have the following syntax:

scar put -f function.yaml -p /path/to/file.txt

This way, the input bucket and input folder would be obtained from the function description in order to reduce verbosity when dealing with Amazon S3.

Same for scar get and scar ls :-D

gmolto avatar Nov 21 '18 16:11 gmolto

I've created a new issue #292 regarding the last part of your message.

alpegon avatar Nov 22 '18 09:11 alpegon

Bug fixed in PR #294 We can continue the enhancement discussion in Issue #292

alpegon avatar Nov 22 '18 10:11 alpegon

The same obscure error is obtained when trying to create a function out of a file that references a non-existent file:

unctions:
  scar-alpine:
    image: alpine
    memory: 128
    init_script: non-existent-file.sh
scar init -f scar-function.yaml

Info: installing 1.1.3 Packing udocker files There was an unmanaged exception in prepare_lambda_code

Expected behaviour: Output the error message from the exception (which is included in the log): 2018-11-23 13:27:35,333 - root - ERROR - [Errno 2] No such file or directory: 'non-existent-file.sh'

gmolto avatar Nov 23 '18 12:11 gmolto