I get no output from the task

Hello, I have a function, which runs perfectly fine on its own, with the following header:
[ensemble_2drift_dwm_nb, acc_2drift_dwm_nb, ens_hist_2drift_dwm_nb, result_2drift_dwm_nb, preds_2drift_dwm_nb, result_test_2drift_dwm_nb, preds_test_2drift_dwm_nb, avg_result_test_2drift_dwm_nb, exp_hist_2drift_dwm_nb] = dwm03_bin_testset(data_2drift_train, lab_2drift_train, 0.5, 0.01, 1, naivebc_r, data_2drift_test, lab_2drift_test)
now I want to run the above function in a separate task. For this purpose I use the following code:
j1 = createJob();
t1 = createTask(j1, @dwm03_bin_testset, 9, {data_2drift_train, lab_2drift_train, 0.5, 0.01, 1, naivebc_r, data_2drift_test, lab_2drift_test});
submit(j1);
waitForState(j1);
get(t1, 'State')
taskoutput1 = get(t1, 'OutputArguments');
Problem: After running this script, the variable taskoutput1, which is supposed to store the output from the function call, is 0x0 cell array.
Now, I was testing this and noticed that I get 'finished' state of the job much faster than I should. Also, I am not sure whether the function call in the task uses the same path as normal function call, because when I was testing with a simple function, and put it in some other folder, which was included in path, I was getting 0x0 cell array as an output as well.
Can anyone shed some light on this issue? My version of Matlab is R2011a. Thanks.

 채택된 답변

Jason Ross
Jason Ross 2013년 2월 6일
편집: Jason Ross 2013년 2월 6일

0 개 추천

Check the task for an Error, something like
taskerror1 = get(t1, 'Error')
This might help you to debug your issue. You can also get the ErrorMessage and ErrorIdentifier, as well.

댓글 수: 4

Rashid
Rashid 2013년 2월 6일
Thanks for the tip. I did that and found out that, as I suspected, a file, which is in a folder which I add to the path before running the script, is not found during the function call. As I mentioned, everything works when I call the same function without creating a task, so I assume there are path rules specifically related to tasks. How can I make my task "see" all the needed files, short of copying each one of them in the folder where I run the task from?
Jason Ross
Jason Ross 2013년 2월 6일
편집: Jason Ross 2013년 2월 6일
There are a couple of ways to add files or paths.
  1. In the cluster profile (Parallel, Manage Configuration, select your configuration), add the files/paths under the "Jobs" tab. This means any jobs and tasks created using this profile will have these paths added.
  2. Set the PathDependencies or FileDependencies on the job object (in your case, j1). There are examples in the help about how to create both. These will be added for only this code.
Rashid
Rashid 2013년 2월 6일
thanks again, tried the first way and it worked
Jason Ross
Jason Ross 2013년 2월 6일
Great! Keep in mind that any job you submit to the cluster will have those files/directories attached. If you don't want that, use the second option.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Big Data Processing에 대해 자세히 알아보기

제품

질문:

2013년 2월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by