RVC3-MATLAB icon indicating copy to clipboard operation
RVC3-MATLAB copied to clipboard

Unrecognized function `getCurrentJob` when running `imtool`

Open remo-pillat opened this issue 1 year ago • 1 comments

Describe the bug I recently ran all of our RVC3 book tests (running the MLX chapter files) with 24b. There was an error complaining about getCurrentJob (Parallel Computing Toolbox) not being found in chapter11.mlx.

Error snippet:

2024-12-02T04:02:47.2798157Z ================================================================================ 2024-12-02T04:02:47.2799382Z Error occurred in tChapter11/runMLXFile and it did not run to completion. 2024-12-02T04:02:47.2800503Z --------- 2024-12-02T04:02:47.2801583Z Error ID: 2024-12-02T04:02:47.2802194Z --------- 2024-12-02T04:02:47.2803014Z 'MATLAB:UndefinedFunction' 2024-12-02T04:02:47.2803508Z -------------- 2024-12-02T04:02:47.2803828Z Error Details: 2024-12-02T04:02:47.2804218Z -------------- 2024-12-02T04:02:47.2804571Z Unrecognized function or variable 'getCurrentJob'. 2024-12-02T04:02:47.2804971Z
2024-12-02T04:02:47.2805389Z Error in parallel.internal.pool.isPoolWorker (line 15) 2024-12-02T04:02:47.2805801Z j = getCurrentJob(); 2024-12-02T04:02:47.2806090Z
2024-12-02T04:02:47.2806437Z Error in images.internal.isFigureAvailable (line 9) 2024-12-02T04:02:47.2806875Z if ~parallel.internal.pool.isPoolWorker() && ... 2024-12-02T04:02:47.2807305Z
2024-12-02T04:02:47.2807669Z Error in images.compatibility.imtool.r2023b.imtool (line 3) 2024-12-02T04:02:47.2808096Z if ~images.internal.isFigureAvailable() 2024-12-02T04:02:47.2808430Z
2024-12-02T04:02:47.2808724Z Error in imtool (line 28) 2024-12-02T04:02:47.2809134Z htool = images.compatibility.imtool.r2023b.imtool(varargin{:}); 2024-12-02T04:02:47.2809551Z
2024-12-02T04:02:47.2809851Z Error in chapter11 (line 18) 2024-12-02T04:02:47.2810548Z imtool(street) 2024-12-02T04:02:47.2810797Z
2024-12-02T04:02:47.2811110Z Error in run (line 112) 2024-12-02T04:02:47.2811453Z evalin('caller', strcat(scriptStem, ';')); 2024-12-02T04:02:47.2811838Z
2024-12-02T04:02:47.2812142Z Error in RunMLX/runFile (line 57) 2024-12-02T04:02:47.2812502Z run(testCase.MLXFile); 2024-12-02T04:02:47.2812800Z
2024-12-02T04:02:47.2813174Z Error in RunMLX>@(varargin)testCase.runFile(varargin{:}) (line 48) 2024-12-02T04:02:47.2813833Z testCase.verifyWarningFree(@testCase.runFile, ... 2024-12-02T04:02:47.2814193Z
2024-12-02T04:02:47.2814502Z Error in 2024-12-02T04:02:47.2814922Z matlab.unittest.internal.constraints.FunctionHandleConstraint/invoke (line 2024-12-02T04:02:47.2815380Z 35) 2024-12-02T04:02:47.2815713Z [varargout{1:nargout}] = fcn(); 2024-12-02T04:02:47.2816107Z
2024-12-02T04:02:47.2816326Z Error in 2024-12-02T04:02:47.2816808Z matlab.unittest.internal.constraints.WarningQualificationConstraint/invoke 2024-12-02T04:02:47.2817290Z (line 43) 2024-12-02T04:02:47.2817726Z constraint.invoke@matlab.unittest.internal.constraints.FunctionHandleConstraint(fcn); 2024-12-02T04:02:47.2818303Z
2024-12-02T04:02:47.2818685Z Error in matlab.unittest.constraints.IssuesNoWarnings/issuesNoWarnings (line 2024-12-02T04:02:47.2819136Z 141) 2024-12-02T04:02:47.2819461Z constraint.invoke(actual); 2024-12-02T04:02:47.2819778Z
2024-12-02T04:02:47.2820156Z Error in matlab.unittest.constraints.IssuesNoWarnings/satisfiedBy (line 84) 2024-12-02T04:02:47.2820688Z constraint.issuesNoWarnings(actual); 2024-12-02T04:02:47.2821091Z
2024-12-02T04:02:47.2821324Z Error in 2024-12-02T04:02:47.2821778Z matlab.unittest.internal.constraints.CasualDiagnosticDecorator/satisfiedBy 2024-12-02T04:02:47.2822242Z (line 42) 2024-12-02T04:02:47.2822548Z bool = decorator.Constraint.satisfiedBy(actual); 2024-12-02T04:02:47.2822957Z
2024-12-02T04:02:47.2823190Z Error in 2024-12-02T04:02:47.2823594Z matlab.unittest.internal.qualifications.QualificationDelegate/qualifyThat 2024-12-02T04:02:47.2824142Z (line 82) 2024-12-02T04:02:47.2824453Z result = constraint.satisfiedBy(actual); 2024-12-02T04:02:47.2824776Z
2024-12-02T04:02:47.2825057Z Error in 2024-12-02T04:02:47.2825563Z matlab.unittest.internal.qualifications.QualificationDelegate/qualifyWarningFree 2024-12-02T04:02:47.2826039Z (line 224) 2024-12-02T04:02:47.2826433Z delegate.qualifyThat(qualifiable, notificationData, actual, 2024-12-02T04:02:47.2826894Z issuesNoWarningsWithOutputs, varargin{:}); 2024-12-02T04:02:47.2827219Z
2024-12-02T04:02:47.2827875Z Error in matlab.unittest.qualifications.Verifiable/verifyWarningFree (line 2024-12-02T04:02:47.2828439Z 833) 2024-12-02T04:02:47.2828678Z [varargout{1:nargout}] = 2024-12-02T04:02:47.2829187Z qualifyWarningFree(verifiable.VerificationDelegate, ... 2024-12-02T04:02:47.2829592Z
2024-12-02T04:02:47.2829832Z Error in RunMLX/runMLXFile (line 48) 2024-12-02T04:02:47.2830263Z testCase.verifyWarningFree(@testCase.runFile, ... 2024-12-02T04:02:47.2830732Z ================================================================================

See the full error log here: https://tinyurl.com/bddb8r82.

To Reproduce Run chapter11.mlx in MATLAB 24b

remo-pillat avatar Dec 02 '24 13:12 remo-pillat

This doesn't seem to be a problem in a proper MATLAB installation, but related to how tests are run through GitHub Actions. In particular, the failure occurs in parallel.internal.pool.isPoolWorker when system_dependent('isdmlworker') returns true. Note that parallel.internal.pool.isPoolWorker ships with base MATLAB, but the code path that's using getCurrentJob (only shipping in Parallel Computing Toolbox) is executed when running the unit test with the GitHub Action.

The code snippet that causes the failure in the unit test can be simplified to:

street = imread("street.png");
imtool(street)

Here are the things I tried that WORKED:

(1) Installed MATLAB 24b with all products that are indicated in RVC3 p706. Parallel Computing Toolbox is not part of that list.

  • Executed that code snippet without a problem
  • Created an MLX file with that code snippet and lightweight TestCase to run that MLX file (to emulate the MLX test in GitHub)
  • Ran test successfully with runtests

(2) Ran code snippet in MATLAB Online 24b (https://matlab.mathworks.com/)

  • Also run without a problem
  • The MATLAB Online environment has all products available (including Parallel Computing Toolbox)

Next steps: (a) Find a smaller reproduction that doesn't rely on "street.png". imtool(zeros(480,640,"uint8")) should work. (b) Verify with a GitHub Action run_command that system_dependent('isdmlworker') indeed returns true when running. (c) Create a new custom GitHub Action run_tests that only installs MATLAB + Image Processing Toolbox and still shows the same failure.

With these next steps, I should be able to further narrow down where the failure is coming from.

remo-pillat avatar Dec 03 '24 11:12 remo-pillat