Skip to content

Commit

Permalink
Merge pull request #325 from grycap/update-batch
Browse files Browse the repository at this point in the history
Update batch mangement
  • Loading branch information
Alfonso Pérez authored Jul 5, 2019
2 parents 91bb3ea + c38d971 commit 4e478d7
Show file tree
Hide file tree
Showing 45 changed files with 2,758 additions and 2,073 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ SCAR allows to create serverless workflows by combining functions that run on ei

## Update 3.0.0

![SCAR-back](docs/source/images/scar-back.gif)

Since version 3.0.0 SCAR creates a lambda layer called 'faas-supervisor' that is the core functionality of the lambda containers.
This layer allows to deploy faster the new functions. The layer is created once (the first time that a function is created) and then it's linked by all the other functions.
Since version 3.0.0 SCAR creates a lambda layer called 'faas-supervisor' that includes the core functionality for the lambda containers.
This layer allows to deploy new functions faster. The layer is created once (the first time that a function is created or after a layer update) and then it's linked to all the other functions.

If a new version of the supervisor is released (e.g. when a new feature is added or a bug is found) the functions can be updated with the command `scar update -a -sl`.

To check the supervisor layer version that your funciotn is using you only have to do an ls like `scar ls`
To check the supervisor layer version that your function is using you only have to do an ls like `scar ls`

## Documentation

Expand Down
Binary file removed docs/source/images/scar-back.gif
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/aws-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Credentials can be passed through the following environment variables:
Assuming that these variables are already populated on your machine, you would list all the EC2 instances by issuing the command:

```sh
docker run --rm -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY grycap/aws-cli ec2 describe-instances
docker run --rm -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY grycap/aws-cli lambda list-functions
```

Further information is available in the [AWS CLI documentation](https://aws.amazon.com/documentation/cli/).
Expand All @@ -30,7 +30,7 @@ scar init -f scar-aws-cli.yaml
2. Execute the Lambda function

```sh
scar run -f scar-aws-cli.yaml ec2 describe-instances
scar run -f scar-aws-cli.yaml lambda list-functions
```

You have the AWS CLI running on AWS Lambda.
20 changes: 10 additions & 10 deletions examples/darknet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,25 @@ scar invoke -f scar-darknet-api-s3.yaml -db dog.jpg -a
When the execution of the function finishes, the script used produces two output files and SCAR copies them to the S3 bucket used. To check if the files are created and copied correctly you can use the command:

```sh
scar ls -b scar-darknet-bucket -bf scar-darknet-s3/output
scar ls -b scar-darknet/scar-darknet-api/output
```

Which outputs:
```
darknet/output/68f5c9d5-5826-44gr-basc-8f8b23f44cdf/image-result.png
darknet/output/68f5c9d5-5826-44gr-basc-8f8b23f44cdf/result.out
scar-darknet-api/output/68f5c9d5-5826-44gr-basc-8f8b23f44cdf/image-result.png
scar-darknet-api/output/68f5c9d5-5826-44gr-basc-8f8b23f44cdf/result.out
```

The files are created in the output folder following the `s3://scar-darknet-bucket/scar-darknet-s3/output/$REQUEST_ID/*.*` structure.
The files are created in the output folder following the `s3://$BUCKET_NAME/$FUNCTION_NAME/output/$REQUEST_ID/*.*` structure.


To download the created files you can also use SCAR. Download a folder with:

```sh
scar get -b scar-darknet-bucket -bf scar-darknet-s3/output -p /tmp/lambda/
scar get -b scar-darknet/scar-darknet-api/output -p /tmp/lambda/
```

This command creates and `ouput` folder and all the subfolders in the `/tmp/lambda/` folder
This command creates the `scar-darknet-api/ouput` folder and all the required subfolders in the `/tmp/lambda/` folder

In our case the two output files are result.out:

Expand All @@ -99,7 +99,7 @@ and image-result.png:
Don't forget to delete the function when you finish your testing:

```sh
scar rm -f scar-darknet-api.yaml
scar rm -f scar-darknet-api-s3.yaml
```

Have in mind that the bucket and the folders and files created are not deleted when the function is deleted.
Expand All @@ -108,13 +108,13 @@ If you want to delete the bucket you have to do it manually.

### Processing the output locally

The last option when invoking or running a synchronous function is to save the output in our machine.
Other option when invoking a synchronous function is to store the output in our machine.

When using this option you have to make sure that the output generated by your script is the binary content that you want to save in your machine. Also due to the API Gateway limits your function has to finish in 30 seconds or less.

The script `scar-darknet-api.yaml` process the image using darknet, packages the image output and the darknet output, and then passes to the standard output the packaged file.
The script `scar-darknet-api-bin.yaml` process the image using darknet, packages the image output and the darknet output, and then dumps the packaged file in the standard output.

The supervisor reads the binary content and then creates the file in the specified file by the CLI command:
SCAR reads the output binary content and then creates the file in the specified file by the CLI command:

```sh
scar init -f scar-darknet-api-bin.yaml
Expand Down
2 changes: 1 addition & 1 deletion examples/ffmpeg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ scar init -f scar-ffmpeg.yaml

Upload a video to the S3 bucket. For these examples we are using sample videos from the [ICPR 2010 Contest on Semantic Descriptio if Human Activities (SDAH 2010)](http://cvrc.ece.utexas.edu/SDHA2010/Human_Interaction.html).
```sh
scar put -b scar-test -bf scar-ffmpeg/input -p seq1.avi
scar put -b scar-test/scar-ffmpeg/input -p seq1.avi
```

To check the progress of the function invocation you can call the `log` command:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ configparser
requests
pyyaml
setuptools>=40.8.0
packaging
14 changes: 7 additions & 7 deletions scar/cmdtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@ def init(self):
@abc.abstractmethod
def invoke(self):
pass

@abc.abstractmethod
def run(self):
pass

@abc.abstractmethod
def update(self):
pass

@abc.abstractmethod
def ls(self):
pass

@abc.abstractmethod
def rm(self):
pass

@abc.abstractmethod
def log(self):
pass

@abc.abstractmethod
def put(self):
pass

@abc.abstractmethod
def get(self):
pass

@abc.abstractmethod
def parse_arguments(self, args):
pass
Loading

0 comments on commit 4e478d7

Please sign in to comment.