Giter Site home page Giter Site logo

wlandau / crew.aws.batch Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 1.0 4.68 MB

A {crew} launcher plugin for AWS Batch

Home Page: https://wlandau.github.io/crew.aws.batch

License: Other

R 100.00%
aws-batch crew high-performance-computing r r-package rstats

crew.aws.batch's People

Contributors

wlandau avatar wlandau-lilly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shikokuchuo

crew.aws.batch's Issues

GitHub interactions are temporarily limited because the maintainer is out of office.

Vacation mode

When this issue is open, vacation mode is turned on. That means Github interactions are temporarily limited, so users cannot open or comment on issues or discussions until I return and re-enable interactions (see return date below). When this issue is closed, vacation mode is turned off and interactions are re-enabled and possible again.

Thanks

Vacation mode helps me rest because it prevents tasks from piling up in my absence. Thank you for your patience and understanding.

Day of my return

Already returned.

Vacation mode source code

Job monitoring utilities

It would be great to have standalone R function utilities to manage batch jobs. These would run in the user's interactive session outside the targets pipeline / crew controller. I am thinking of covering the same functionality as qsub, qstat, and qdel in SGE (sbatch, squeue, and scancel in SLURM), plus log files. Proposal:

  1. crew_aws_batch_submit(): submit a job that runs some code (R or shell). This could help e.g. submit a targets pipeline as a Batch job which submits other Batch jobs.
  2. crew_aws_batch_status(): get the status of jobs in a given job queue / job definition.
  3. crew_aws_batch_terminate(): terminate one or more jobs with specific job names/IDs/ARNs.
  4. crew_aws_batch_logs(): log files for one or more jobs, or for an entire job definition. This would really help detect tricky worker-level errors such as running out of memory or hitting a price spike that terminates spot instances.

Paginate logs from the monitor

Because of paws-r/paws#721, the log() method of the monitor currently does not use pagination. When that issue is fixed, I will replace this:

pages <- list( # TODO: paws.common::paginate() # nolint
client$get_log_events(
logGroupName = private$.log_group,
logStreamName = log_stream_name,
startFromHead = start_from_head
)
)

with this:

pages <- paws.common::paginate(
  client$get_log_events(
    logGroupName = private$.log_group,
    logStreamName = log_stream_name,
    startFromHead = start_from_head
  )
)

and test it with this:

test_that("job logs", {
x <- crew_aws_batch_monitor(
job_definition = "crew-aws-batch-test",
job_queue = "crew-aws-batch-job-queue",
region = "us-east-2"
)
x$register(
image = "alpine:latest",
platform_capabilities = "EC2",
memory_units = "gigabytes",
memory = 1,
cpus = 1,
seconds_timeout = 600,
tags = c("crew_aws_batch_1", "crew_aws_batch_2"),
propagate_tags = TRUE
)
on.exit(x$deregister())
job <- x$submit(
command = c("echo", "done with container\ndone with job"),
memory_units = "mebibytes",
memory = 128,
cpus = 1
)
attempts <- 0L
done <- c("succeeded", "failed")
while (!((status <- x$status(id = job$id)$status) %in% done)) {
message(
paste(
"job status:",
status,
sample(c("-", "\\", "|", "/"), size = 1L)
)
)
attempts <- attempts + 1L
if (attempts > 60L) {
stop("job did not finish")
}
Sys.sleep(5)
}
log <- x$log(id = job$id)
expect_true(tibble::is_tibble(log))
expect_equal(log$message, c("done with container", "done with job"))
})

Job definition guidance

Either a function to create new job definitions or documentation for how to do this. Sketch using the CLI:

aws batch register-job-definition \
  --job-definition-name YOUR_JOB_DEFINITION_NAME \
  --type container \
  --container-properties "image=AWS_ACCOUNT.dkr.ecr.AWS_REGION.amazonaws.com/IMAGE_NAME:IMAGE_TAG, vcpus=4, memory=16000"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.