Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
ebec727c
Commit
ebec727c
authored
Oct 03, 2019
by
David Monllaó
Browse files
MDL-66004 mlbackend_python: Purge testing output dirs properly
parent
463b63db
Changes
2
Hide whitespace changes
Inline
Side-by-side
analytics/tests/prediction_test.php
View file @
ebec727c
...
...
@@ -54,6 +54,23 @@ require_once(__DIR__ . '/../../course/lib.php');
*/
class
core_analytics_prediction_testcase
extends
advanced_testcase
{
/**
* Purge all the mlbackend outputs.
*
* This is done automatically for mlbackends using the web server dataroot but
* other mlbackends may store files elsewhere and these files need to be removed.
*
* @return null
*/
public
function
tearDown
()
{
$this
->
setAdminUser
();
$models
=
\
core_analytics\manager
::
get_all_models
();
foreach
(
$models
as
$model
)
{
$model
->
delete
();
}
}
/**
* test_static_prediction
*
...
...
@@ -414,7 +431,8 @@ class core_analytics_prediction_testcase extends advanced_testcase {
// Training should work correctly if at least 1 sample of each class is included.
$dir
=
make_request_directory
();
$result
=
$predictionsprocessor
->
train_classification
(
'whatever'
.
microtime
(),
$dataset
,
$dir
);
$modeluniqueid
=
'whatever'
.
microtime
();
$result
=
$predictionsprocessor
->
train_classification
(
$modeluniqueid
,
$dataset
,
$dir
);
switch
(
$success
)
{
case
'yes'
:
...
...
@@ -429,6 +447,10 @@ class core_analytics_prediction_testcase extends advanced_testcase {
// what we really want to check is that an exception was not thrown.
$this
->
assertInstanceOf
(
\
stdClass
::
class
,
$result
);
}
// Purge the directory used in this test (useful in case the mlbackend is storing files
// somewhere out of the default moodledata/models dir.
$predictionsprocessor
->
delete_output_dir
(
$dir
,
$modeluniqueid
);
}
/**
...
...
lib/mlbackend/python/classes/processor.php
View file @
ebec727c
...
...
@@ -38,7 +38,7 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso
/**
* The required version of the python package that performs all calculations.
*/
const
REQUIRED_PIP_PACKAGE_VERSION
=
'2.2.
0
'
;
const
REQUIRED_PIP_PACKAGE_VERSION
=
'2.2.
1
'
;
/**
* The python package is installed in a server.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment