Skip to content

Commit

Permalink
Create a Docker image for topic generator (#505)
Browse files Browse the repository at this point in the history
https://ucsc-cgl.atlassian.net/browse/SEAB-6653

---------

Co-authored-by: Kathy Tran <kathylevtran@gmail.com>
  • Loading branch information
coverbeck and kathy-t authored Oct 21, 2024
1 parent b964bfb commit 0db8b4b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy_tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ jobs:
uses: dockstore/workflow-actions/.github/workflows/deploy_tagged.yaml@main
with:
changelist: ${{ inputs.changelist }}
createDockerImage: true
dockerTagPrefix: 'quay.io/dockstore/dockstore-support'
secrets: inherit
32 changes: 30 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
push:
branches: [ '**' ]
tags: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:
Expand All @@ -34,3 +32,33 @@ jobs:
run: ./mvnw -B clean install
- name: code coverage
run: bash <(curl -s https://codecov.io/bash)

- if: github.ref == 'refs/heads/develop'
name: Set S3 folder name and quay tag name
run: |
S3_FOLDER=${GITHUB_REF##refs/tags/}
if [ $GITHUB_REF == $S3_FOLDER ]; then
# If this isn't a tag, it must be a branch
S3_FOLDER=${GITHUB_REF##refs/heads/}
fi
# QUAY_TAG differs from S3_FOLDER because it only contains the git ref with no short hash. It also replaces slashes with underscores.
echo "QUAY_TAG=${S3_FOLDER//\//_}" >> $GITHUB_ENV
echo "S3_FOLDER=${S3_FOLDER}-$(echo $GITHUB_SHA | cut -c -7)" >> $GITHUB_ENV
# neat, quay itself uses manual github actions https://github.com/quay/quay/blob/master/.github/workflows/build-and-publish.yaml
- if: github.ref == 'refs/heads/develop'
name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

- if: github.ref == 'refs/heads/develop'
name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: quay.io/dockstore/dockstore-support:${{env.QUAY_TAG}}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM eclipse-temurin:21.0.2_13-jdk-jammy

# Update the APT cache
# Prepare for Java download
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install unzip jq -y --no-install-recommends

# Install aws cli so dockstore-deploy can use the aws cli to upload files to S3
RUN curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
RUN unzip -q /tmp/awscliv2.zip -d /tmp
RUN /tmp/aws/install
RUN rm -f /tmp/awscliv2.zip
RUN rm -fr /tmp/aws

# Copy, for example, topicgenerator-1.16.0-SNAPSHOT.jar, but not topicgenerator-1.16.0-SNAPSHOT-sources.jar
COPY topicgenerator/target/topicgenerator*[^s].jar /home/topic-generator.jar
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.beust.jcommander.ParameterException;
import com.google.common.collect.Lists;
import io.dockstore.common.NextflowUtilities;
import io.dockstore.common.NextflowUtilities.NextflowParsingException;
import io.dockstore.openapi.client.ApiClient;
import io.dockstore.openapi.client.ApiException;
import io.dockstore.openapi.client.api.ExtendedGa4GhApi;
Expand Down Expand Up @@ -320,7 +321,13 @@ private FileWrapper getDescriptorFile(Ga4Ghv20Api ga4Ghv20Api, String trsId, Str
}

private Optional<FileWrapper> getNextflowMainScript(String nextflowConfigFileContent, Ga4Ghv20Api ga4Ghv20Api, String trsId, String versionId, DescriptorTypeEnum descriptorType) {
final String mainScriptPath = NextflowUtilities.grabConfig(nextflowConfigFileContent).getString("manifest.mainScript", "main.nf");
final String mainScriptPath;
try {
mainScriptPath = NextflowUtilities.grabConfig(nextflowConfigFileContent).getString("manifest.mainScript", "main.nf");
} catch (NextflowParsingException e) {
LOG.error("Could not grab config", e);
return Optional.empty();
}
try {
return Optional.of(ga4Ghv20Api.toolsIdVersionsVersionIdTypeDescriptorRelativePathGet(trsId, descriptorType.toString(), versionId, mainScriptPath));
} catch (ApiException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.knuddels.jtokkit.api.ModelType;

public enum AIModelType {
CLAUDE_3_5_SONNET("anthropic.claude-3-5-sonnet-20240620-v1:0", 0.003, 0.015, 200000),
CLAUDE_3_HAIKU("anthropic.claude-3-haiku-20240307-v1:0", 0.00025, 0.00125, 200000),
CLAUDE_3_5_SONNET("us.anthropic.claude-3-5-sonnet-20240620-v1:0", 0.003, 0.015, 200000),
CLAUDE_3_HAIKU("us.anthropic.claude-3-haiku-20240307-v1:0", 0.00025, 0.00125, 200000),
GPT_4O_MINI(ModelType.GPT_4O_MINI.getName(), 0.000150, 0.000600, ModelType.GPT_4O_MINI.getMaxContextLength());

private final String modelId;
Expand Down

0 comments on commit 0db8b4b

Please sign in to comment.