Skip to content

Commit

Permalink
Revert security fixes and make the job nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
msaroufim committed Feb 20, 2023
1 parent ebe4cf8 commit aa02933
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 29 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

concurrency:
group: codeql-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
# run every day at 11:15am
schedule:
- cron: '15 11 * * *'

jobs:
analyze:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static File unzip(InputStream is, String eTag, String type) throws IOExce

MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new AssertionError(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.net.HttpURLConnection;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand All @@ -19,7 +18,6 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.stream.Collectors;
import org.pytorch.serve.archive.DownloadArchiveException;
import org.pytorch.serve.archive.model.Manifest;
import org.pytorch.serve.archive.model.ModelArchive;
Expand Down Expand Up @@ -225,16 +223,12 @@ private void setupModelDependencies(Model model)
model.getModelDir().getAbsolutePath(),
null);

Map<String, String> env =
Arrays.stream(envp)
.map(e -> e.split("=", 2))
.collect(Collectors.toMap(e -> e[0], e -> e[1]));

ProcessBuilder pb = new ProcessBuilder(packageInstallCommand);
pb.environment().putAll(env);
pb.directory(model.getModelDir().getAbsoluteFile());

Process process = pb.start();
Process process =
Runtime.getRuntime()
.exec(
packageInstallCommand,
envp,
model.getModelDir().getAbsoluteFile());

int exitCode = process.waitFor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,18 @@ public WorkerState getState() {
}

public String getGpuUsage() {
Process process;
StringBuffer gpuUsage = new StringBuffer();
if (gpuId >= 0) {
try {
// TODO : add a generic code to capture gpu details for different devices instead of
// just NVIDIA
ProcessBuilder pb =
new ProcessBuilder(
"nvidia-smi",
"-i",
String.valueOf(gpuId),
"--query-gpu=utilization.gpu,utilization.memory,memory.used",
"--format=csv");
Process process = pb.start();
process =
Runtime.getRuntime()
.exec(
"nvidia-smi -i "
+ gpuId
+ " --query-gpu=utilization.gpu,utilization.memory,memory.used --format=csv");
process.waitFor();
int exitCode = process.exitValue();
if (exitCode != 0) {
Expand Down

0 comments on commit aa02933

Please sign in to comment.