Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: r2lambda
Type: Package
Title: Deploy 'R' Scripts as 'AWS Lambda' Functions
Title: Deploy 'R' Scripts as AWS Lambda Functions
Version: 0.3.0
Authors@R: c(
person("Teofil", "Nakov", , "teofiln@gmail.com", role = "aut",
Expand All @@ -10,12 +10,12 @@ Authors@R: c(
person("Discindo", role = "cph")
)
Description: Build, test and deploy 'R' scripts as Amazon Web Services
('AWS') 'Lambda' functions packaged in 'Docker' container images.
Images are built and tested locally, pushed to the 'AWS' Elastic
(AWS) Lambda functions packaged in 'Docker' container images.
Images are built and tested locally, pushed to the AWS Elastic
Container Registry, and deployed with an execution role; deployed
functions can be invoked, scheduled and deleted from 'R'. Wraps
functionality from the 'paws' and 'lambdr' packages. See
<https://aws.amazon.com/lambda/> for the 'AWS Lambda' service.
<https://aws.amazon.com/lambda/> for the AWS Lambda service.
License: GPL (>= 3)
Depends: R (>= 4.1.0)
Encoding: UTF-8
Expand Down
88 changes: 49 additions & 39 deletions R/lambda-deploy.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
#' @return None, called for its side effect of building a local Docker image.
#'
#' @examples
#' \dontrun{
#' build_lambda(
#' tag = "parity1",
#' runtime_function = "parity",
#' runtime_path = system.file("parity.R", package = "r2lambda")
#' )
#' \donttest{
#' if (interactive()) {
#' build_lambda(
#' tag = "parity1",
#' runtime_function = "parity",
#' runtime_path = system.file("parity.R", package = "r2lambda")
#' )
#' }
#' }
#' @importFrom glue glue glue_collapse single_quote double_quote
#' @export
Expand Down Expand Up @@ -127,9 +129,11 @@ build_lambda <- function(
#' S3, can run more than once.
#'
#' @examples
#' \dontrun{
#' payload <- list(number = 2)
#' test_lambda(tag = "parity1", payload)
#' \donttest{
#' if (interactive()) {
#' payload <- list(number = 2)
#' test_lambda(tag = "parity1", payload)
#' }
#' }
#' @importFrom glue glue glue_collapse single_quote double_quote
#' @export
Expand Down Expand Up @@ -201,27 +205,27 @@ test_lambda <- function(tag, payload) {
#' `Lambda_function_arn`.
#'
#' @examples
#' \dontrun{
#'
#' runtime_function <- "parity"
#' runtime_path <- system.file("parity.R", package = "r2lambda")
#' dependencies <- NULL
#'
#' build_lambda(
#' tag = "myrepo52",
#' runtime_function = runtime_function,
#' runtime_path = runtime_path,
#' dependencies = dependencies
#' )
#' \donttest{
#' if (interactive()) {
#' runtime_function <- "parity"
#' runtime_path <- system.file("parity.R", package = "r2lambda")
#' dependencies <- NULL
#'
#' deploy_lambda(tag = "myrepo52")
#' build_lambda(
#' tag = "myrepo52",
#' runtime_function = runtime_function,
#' runtime_path = runtime_path,
#' dependencies = dependencies
#' )
#'
#' invoke_lambda(
#' function_name = "myrepo52",
#' payload = list(number = 3),
#' invocation_type = "RequestResponse"
#' )
#' deploy_lambda(tag = "myrepo52")
#'
#' invoke_lambda(
#' function_name = "myrepo52",
#' payload = list(number = 3),
#' invocation_type = "RequestResponse"
#' )
#' }
#' }
#' @importFrom paws ecr iam lambda s3 eventbridge cloudwatchlogs
#' @export
Expand Down Expand Up @@ -372,12 +376,14 @@ deploy_lambda <-
#' elements such as `StatusCode` and `Payload` (a raw vector). The payload is
#' also printed.
#' @examples
#' \dontrun{
#' invoke_lambda(
#' function_name = "parity",
#' payload = list(number = 3),
#' invocation_type = "RequestResponse"
#' )
#' \donttest{
#' if (interactive()) {
#' invoke_lambda(
#' function_name = "parity",
#' payload = list(number = 3),
#' invocation_type = "RequestResponse"
#' )
#' }
#' }
#' @export
invoke_lambda <-
Expand Down Expand Up @@ -435,10 +441,12 @@ invoke_lambda <-
#' @return None, called for its side effect of creating the schedule.
#'
#' @examples
#' \dontrun{
#' # Make Tidytuesday lambda fetch the Tidytuesday dataset every Wednesday
#' # at 8 am
#' schedule_lambda("Tidytuesday3", "cron(0 8 * * Wed)")
#' \donttest{
#' if (interactive()) {
#' # Make Tidytuesday lambda fetch the Tidytuesday dataset every Wednesday
#' # at 8 am
#' schedule_lambda("Tidytuesday3", "cron(0 8 * * Wed)")
#' }
#' }
#'
#' @export
Expand Down Expand Up @@ -561,8 +569,10 @@ schedule_lambda <- function(lambda_function, execution_rate) {
#' @return Invisibly, a list with the names of the deleted resources.
#'
#' @examples
#' \dontrun{
#' delete_lambda("parity1")
#' \donttest{
#' if (interactive()) {
#' delete_lambda("parity1")
#' }
#' }
#' @export
delete_lambda <- function(
Expand Down
14 changes: 13 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## Resubmission

This is a resubmission. In this version I have:

* Removed the single quotes around AWS and AWS Lambda in the Title and
Description.
* Replaced `\dontrun{}` in the examples with `\donttest{}`, with an
`if (interactive())` guard inside.
The examples need AWS credentials and a running Docker daemon, and they
create, invoke or delete billable AWS resources, so they run only in an
interactive session.

## R CMD check results

0 errors | 0 warnings | 1 note
Expand All @@ -8,7 +20,7 @@

The `aws_connect()` example runs: it only creates a 'paws' client object,
which needs no credentials and sends no request to AWS. The other examples
are wrapped in `\dontrun{}`: they need AWS credentials, and they create,
run only in interactive sessions: they need AWS credentials, and they create,
invoke or delete billable AWS resources (ECR repositories, IAM roles, Lambda
functions and EventBridge schedules). `build_lambda()`, `test_lambda()`,
`deploy_lambda()` and `delete_lambda()` also need a running Docker daemon.
14 changes: 8 additions & 6 deletions man/build_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/delete_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions man/deploy_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions man/invoke_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions man/schedule_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/test_lambda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading