Repository: deepjavalibrary/djl
Pull request #2167 (2022-11-19 21:42:58)

[dataset] Fixes movielens download issue
## Description ##

Brief description of what this PR is about

- If this change is a backward incompatible change, why must this change be made?
- Interesting edge cases to note here



Patch:
diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml
index 893c002a7..638d88b2d 100644
--- a/.github/workflows/continuous.yml
+++ b/.github/workflows/continuous.yml
@@ -91,7 +91,9 @@ jobs:
         if: always()
         with:
           name: reports
-          path: ${{ github.workspace }}/**/build/reports/**/*
+          path: |
+            ${{ github.workspace }}/**/build/reports/**/*
+            !${{ github.workspace }}/**/build/reports/jacoco/*
       - name: upload to codecov
         uses: codecov/codecov-action@v3
         with:


Test patch:
diff --git a/basicdataset/src/test/resources/mlrepo/dataset/tabular/ai/djl/basicdataset/movielens-100k/metadata.json b/basicdataset/src/test/resources/mlrepo/dataset/tabular/ai/djl/basicdataset/movielens-100k/metadata.json
index 2728d25cf..c2a29e32e 100644
--- a/basicdataset/src/test/resources/mlrepo/dataset/tabular/ai/djl/basicdataset/movielens-100k/metadata.json
+++ b/basicdataset/src/test/resources/mlrepo/dataset/tabular/ai/djl/basicdataset/movielens-100k/metadata.json
@@ -19,11 +19,11 @@
       "snapshot": false,
       "files": {
         "ml-100k": {
-          "uri": "https://files.grouplens.org/datasets/movielens/ml-100k.zip",
-          "sha1Hash": "cd4dcac4241c8a4ad7badc7ca635da8a69dddb83",
-          "size": "4924029"
+          "uri": "1.0/ml-100k.zip",
+          "sha1Hash": "c14dcdbe7e9ae1961f44f58b696ca295c4d3807e",
+          "size": "632294"
         }
       }
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/integration/src/main/java/ai/djl/integration/tests/nn/BlockCoreTest.java b/integration/src/main/java/ai/djl/integration/tests/nn/BlockCoreTest.java
index 9e2809681..d166c71b0 100644
--- a/integration/src/main/java/ai/djl/integration/tests/nn/BlockCoreTest.java
+++ b/integration/src/main/java/ai/djl/integration/tests/nn/BlockCoreTest.java
@@ -60,9 +60,9 @@ import org.testng.annotations.Test;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.stream.IntStream;
 
@@ -1050,11 +1050,14 @@ public class BlockCoreTest {
     private void testEncode(NDManager manager, Block block)
             throws IOException, MalformedModelException {
         PairList<String, Parameter> original = block.getParameters();
-        File temp = Files.createTempFile("block", ".param").toFile();
-        DataOutputStream os = new DataOutputStream(Files.newOutputStream(temp.toPath()));
-        block.saveParameters(os);
-        block.loadParameters(manager, new DataInputStream(Files.newInputStream(temp.toPath())));
-        Files.delete(temp.toPath());
+        Path temp = Files.createTempFile("block", ".param");
+        try (DataOutputStream os = new DataOutputStream(Files.newOutputStream(temp))) {
+            block.saveParameters(os);
+        }
+        try (DataInputStream is = new DataInputStream(Files.newInputStream(temp))) {
+            block.loadParameters(manager, is);
+        }
+        Files.delete(temp);
         PairList<String, Parameter> loaded = block.getParameters();
         int bound = original.size();
         for (int idx = 0; idx < bound; idx++) {