autowisp.browser_interface.home.views module

Class Inheritance Diagram

Inheritance diagram of CameraChannel, Configuration, CreateProjectView, DataModelBase, DatabaseError, DecodingStringFormatter, HttpResponse, Image, MasterConfigView, MasterFile, MasterType, Parameter, PipelineRun, Project, StringIO, ViewError

Define the vies available on the home page.

autowisp.browser_interface.home.views._pattern_to_glob(pattern, known_values, project_home)[source]

Convert a filename pattern to glob by substituting unknown keys with *.

Known keys are replaced with their values from known_values; all remaining {key} or {key:spec} placeholders are replaced with *.

Parameters:
  • pattern (str) – A Python format string with named placeholders.

  • known_values (dict) – Mapping of placeholder names to their values.

Returns:

A glob pattern suitable for glob.iglob().

Return type:

str

autowisp.browser_interface.home.views._safe_remove(fpath, project_home)[source]

Delete fpath after verifying it resides under project_home.

Parameters:
  • fpath (str) – Path to the file to delete.

  • project_home (str) – Absolute path to the project home directory.

Raises:

ViewError – If fpath is not under project_home.

autowisp.browser_interface.home.views.confirm_delete_projects(request)[source]

Show a confirmation page listing projects and file-type checkboxes.

autowisp.browser_interface.home.views.delete_image_products(project_home, data_reductions=True, calibrated_images=True)[source]

Delete data reduction files and/or calibrated images for a project.

Reads the data-reduction-fname and/or calibrated-fname configuration parameters from the project database, then iterates over every Image, reads its FITS header to resolve the templates, and removes the corresponding files.

Parameters:
  • project_home (str) – Absolute path to the project home directory.

  • data_reductions (bool) – If True, delete data reduction files.

  • calibrated_images (bool) – If True, delete calibrated image files.

autowisp.browser_interface.home.views.delete_lightcurves(project_home)[source]

Delete all lightcurve files generated by the project at project_home.

Uses the lightcurve catalog(s) stored as MasterFile entries of type lightcurve_catalog to identify which individual lightcurve files were created, then removes them together with the catalog files themselves.

The lc-fname configuration parameter is read from the project database to determine the filename pattern used when the lightcurves were created.

Parameters:

project_home (str) – Absolute path to the project home directory.

autowisp.browser_interface.home.views.delete_logs(project_home)[source]

Delete all log and stdout/stderr output files for a project.

Reads the logging-fname and std-out-err-fname configuration parameters from the project database, converts the patterns to globs by substituting unknown placeholders with *, and removes all matching files.

Parameters:

project_home (str) – Absolute path to the project home directory.

autowisp.browser_interface.home.views.delete_master_files(project_home)[source]

Delete all master files generated by the project at project_home.

Queries the master_file table for every entry and removes the corresponding file from disk.

Parameters:

project_home (str) – Absolute path to the project home directory.

autowisp.browser_interface.home.views.delete_projects(request)[source]

Delete selected projects and optionally their generated files.

autowisp.browser_interface.home.views.export_master_config(request)[source]

Generate a JSON file with the current master config for new project.

autowisp.browser_interface.home.views.find_missing_databases()[source]

Return projects whose database is not accessible.

A project’s database is considered present when either its SQLite file (autowisp.db) or its centralised-DB connection file (autowisp_db.url) exists under the project home directory.

Returns:

Projects for which neither database indicator exists.

Return type:

list[Project]

autowisp.browser_interface.home.views.home(request)[source]

Display the home page.

autowisp.browser_interface.home.views.prune_empty_directories(project_home)[source]

Remove all empty directories under project_home.

Walks the directory tree bottom-up so that a parent directory is checked only after its children have already been removed if they were empty. The project_home directory itself is never removed.

Parameters:

project_home (str) – Absolute path to the project home directory.

autowisp.browser_interface.home.views.reset_project_config(request)[source]

Reset the configuration of project being created to defaults.

autowisp.browser_interface.home.views.select_project(request, project_id)[source]

Redirect to the processing progress page for the selected project.