Skip to content
Snippets Groups Projects
Commit cf5ada13 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

[py] Allow changing of the temporary directory

parent 0ffbd1af
No related branches found
No related tags found
1 merge request!180[dask] Preparing bob.bio.base for dask pipelines
Pipeline #42021 failed
...@@ -51,9 +51,9 @@ EPILOG = """\b ...@@ -51,9 +51,9 @@ EPILOG = """\b
my_experiment.py must contain the following elements: my_experiment.py must contain the following elements:
>>> transformer = ... # A scikit-learn pipeline >>> transformer = ... # A scikit-learn pipeline\n
>>> algorithm = ... # `An BioAlgorithm` >>> algorithm = ... # `An BioAlgorithm`\n
>>> pipeline = VanillaBiometricsPipeline(transformer,algorithm) >>> pipeline = VanillaBiometricsPipeline(transformer,algorithm)\n
>>> database = .... # Biometric Database connector (class that implements the methods: `background_model_samples`, `references` and `probes`)" >>> database = .... # Biometric Database connector (class that implements the methods: `background_model_samples`, `references` and `probes`)"
\b \b
...@@ -138,6 +138,15 @@ def load_database_pipeline(database, pipeline): ...@@ -138,6 +138,15 @@ def load_database_pipeline(database, pipeline):
is_flag=True, is_flag=True,
help="If set, it will checkpoint all steps of the pipeline", help="If set, it will checkpoint all steps of the pipeline",
) )
@click.option(
"--temp-directory",
"-T",
"temp_dir",
help=(
"Location of the temporary directory where models and probes"
"features, as well as other checkpoint files will be stored"
),
)
@verbosity_option(cls=ResourceOption) @verbosity_option(cls=ResourceOption)
def vanilla_biometrics( def vanilla_biometrics(
pipeline, pipeline,
...@@ -147,6 +156,7 @@ def vanilla_biometrics( ...@@ -147,6 +156,7 @@ def vanilla_biometrics(
output, output,
write_metadata_scores, write_metadata_scores,
checkpoint, checkpoint,
temp_dir,
**kwargs, **kwargs,
): ):
"""Runs the simplest biometrics pipeline. """Runs the simplest biometrics pipeline.
...@@ -203,6 +213,10 @@ def vanilla_biometrics( ...@@ -203,6 +213,10 @@ def vanilla_biometrics(
if not os.path.exists(output): if not os.path.exists(output):
os.makedirs(output, exist_ok=True) os.makedirs(output, exist_ok=True)
# TODO find a better way to do this... (setting temp_directory in pipeline)
import bob.bio.base.pipelines.vanilla_biometrics
bob.bio.base.pipelines.vanilla_biometrics.temp_directory = temp_dir
# Picking the resources # Picking the resources
database, pipeline = load_database_pipeline(database, pipeline) database, pipeline = load_database_pipeline(database, pipeline)
......
  • Maintainer

    @ydayer I believe this change might be responsible for breaking at least the LGBPHS pipeline. Either with of without specifying a -T temp_directory, it crashes with an error message of the type

    RuntimeError: File - constructor: C++ exception caught: 'cannot open file `/tmp/tmpep2b12y5/biometric_references/103.hdf5''
  • Owner

    Thanks for reporting this @lcolbois

    I'll have a look into that this afternoon.

    Cheers

  • Tiago de Freitas Pereira @tiago.pereira

    mentioned in merge request bob.bio.face!68 (merged)

    ·

    mentioned in merge request bob.bio.face!68 (merged)

    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment