Skip to content

Commit

Permalink
Small fixes. Add cache bust to puill latest GoLLM in taskrunner build (
Browse files Browse the repository at this point in the history
  • Loading branch information
kbirk authored Feb 6, 2024
1 parent f08efce commit 163e12f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.test.context.support.WithUserDetails;

import lombok.extern.slf4j.Slf4j;
import software.uncharted.terarium.hmiserver.TerariumApplicationTests;
import software.uncharted.terarium.hmiserver.configuration.MockUser;
import software.uncharted.terarium.hmiserver.models.task.TaskRequest;
import software.uncharted.terarium.hmiserver.models.task.TaskResponse;
import software.uncharted.terarium.hmiserver.models.task.TaskStatus;

@Slf4j
public class TaskServiceTest extends TerariumApplicationTests {

@Autowired
Expand Down Expand Up @@ -106,7 +108,7 @@ public void testItCanSendGoLLMModelCardRequest() throws Exception {
req.setScript("gollm:model_card");
req.setInput(content.getBytes());

List<TaskResponse> responses = taskService.runTaskBlocking(req);
List<TaskResponse> responses = taskService.runTaskBlocking(req, 300);

Assertions.assertEquals(3, responses.size());
Assertions.assertEquals(TaskStatus.QUEUED, responses.get(0).getStatus());
Expand All @@ -116,6 +118,8 @@ public void testItCanSendGoLLMModelCardRequest() throws Exception {
for (TaskResponse resp : responses) {
Assertions.assertEquals(taskId, resp.getId());
}

log.info(new String(responses.get(responses.size() - 1).getOutput()));
}

// @Test
Expand Down
24 changes: 13 additions & 11 deletions packages/taskrunner/docker/Dockerfile.GoLLM
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ FROM python:3.10-slim

WORKDIR /

# Install OpenJDK JRE
RUN apt-get update && \
apt-get install -y --no-install-recommends openjdk-17-jre-headless && \
rm -rf /var/lib/apt/lists/*

# Copy the Spring Boot fat JAR from the builder image
COPY --from=taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Copy the echo script for testing
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py

# Install wget
RUN apt-get update && \
apt-get install -y --no-install-recommends wget && \
rm -rf /var/lib/apt/lists/*

RUN echo "Cache bust so we can always pull latest GoLLM" $(date -u)
RUN wget -O gollm.tar.gz https://github.com/DARPA-ASKEM/GoLLM/archive/refs/heads/main.tar.gz && \
tar -zxvf gollm.tar.gz && \
mv GoLLM-* GoLLM
Expand All @@ -27,17 +40,6 @@ WORKDIR /GoLLM
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -e .

# Install OpenJDK JRE
RUN apt-get update && \
apt-get install -y --no-install-recommends openjdk-17-jre-headless && \
rm -rf /var/lib/apt/lists/*

# Copy the Spring Boot fat JAR from the builder image
COPY --from=taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Copy the echo script for testing
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py

WORKDIR /

CMD ["java", "-jar", "taskrunner.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ public void start() throws IOException, InterruptedException {
}
}).start();

} catch (Exception e) {
status = TaskStatus.FAILED;
throw e;
} finally {
lock.unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void testTaskCancelMultipleTimes() throws Exception {
for (int i = 0; i < 10; i++) {
boolean res = task.cancel();
if (cancelled) {
Assertions.assertTrue(false);
Assertions.assertFalse(res);
} else {
Assertions.assertTrue(res);
cancelled = true;
Expand Down

0 comments on commit 163e12f

Please sign in to comment.