A Docker image containing the tools to update and archive files, and to generate CAOM2 Observations from Allen I Carswell Observatory (AICO).
- Set Up (One Time Only)
- Initialize Workspace (One Time Only)
- Prepare Sky Camera Images
- Ingest Sky Camera Images
- Debugging
These are Linux-centric instructions.
In an empty directory (the 'working directory'), on a machine with Docker installed:
-
In the main branch of this repository, find the file
Dockerfile
and copy it to the working directory. -
To build the container image, run this:
docker build -f Dockerfile -t aico2caom2_app ./
-
Run the following command to create a proxy certificate file in the working directory. You will be prompted for the password, unless you have an appropriately configured
.netrc
file:docker run --rm -ti --user $(id -u):$(id -g) -e HOME=/usr/src/app -v ${PWD}:/usr/src/app aico2caom2_app cadc-get-cert --cert-filename /usr/src/app/cadcproxy.pem --days-valid 10 -u <CADC User Name here>
-
The
aico_run*.sh
scripts described later will attempt to copy$HOME/.ssl/cadcproxy.pem
to the 'working directory', so copycadcproxy.pem
to$HOME/.ssl/
. -
The proxy certificate file will be valid for 10 days, and must be periodically renewed. At the moment, it is possible to use a .netrc file and a cron job to automatically renew the certificate. Add something like the following to a crontab:
0 0 * * * docker run --rm -ti --user $(id -u):$(id -g) -e HOME=/usr/src/app -v ${PWD}:/usr/src/app aico2caom2_app cadc-get-cert -n -q --cert-filename /usr/src/app/cadcproxy.pem --days-valid=25
Modify the
aico_run*.sh
scripts to use the location of the renewed certificate filecadcproxy.pem
.
aico2caom2
can store files from local disk to CADC storage. This behaviour is controlled by configuration
information, located in a file named config.yml
. Most of the config.yml
values are already set appropriately, but there are a few values that need to be
set according to the execution environment. For a complete description of the config.yml
content, see
https://github.com/opencadc/collection2caom2/wiki/config.yml.
-
Copy the file
config.yml
to the working directory. e.g.:wget https://raw.github.com/opencadc/aico2caom2/main/config/config.yml
-
Tell
aico2caom2
inconfig.yml
what to do with files on disk after the files have been stored to CADC:-
Set
cleanup_files_when_storing
toTrue
orFalse
.- If this is set to
False
,aico2caom2
will do nothing with the files on disk. - If this is set to
True
,aico2caom2
will move stored files to either a success or failure location.
- If this is set to
-
If
cleanup_files_when_storing
is set toTrue
, setcleanup_failure_destination
andcleanup_success_destination
to fully-qualified directory names that are visible within the Docker container. A directory is visible within a Docker container if it is one of the values on the right-hand-side of the colon in a-v
docker run
parameter.
-
-
Tell
aico2caom
inconfig.yml
whether to re-submit duplicate files.- Set
store_modified_files_only
toTrue
orFalse
. If this is set toFalse
, there is no effect on execution. If this is set to true,aico2caom2
checks that the local version of the file has a md5 checksum that is different from the file at CADC before transferring the file to CADC storage. This affects only thestore
task_types
.
- Set
-
In the main branch of this repository, find the scripts directory, and copy the files
aico_run.sh
andaico_run_incremental.sh
to the working directory. e.g.:wget https://raw.github.com/opencadc/aico2caom2/scripts/aico_run.sh wget https://raw.github.com/opencadc/aico2caom2/scripts/aico_run_incremental.sh
-
Ensure the scripts are executable:
chmod +x aico_run.sh chmod +x aico_run_incremental.sh
-
Edit the scripts to specify the file location:
-
aico_run.sh
:- Find this line:
docker run --rm --name ${COLLECTION}_todo --user $(id -u):$(id -g) -e HOME=/usr/src/app -v ${PWD}:/usr/src/app/ -v /data:/data ${IMAGE} ${COLLECTION}_run || exit $?
- Replace the
/data/:
portion of the command with the fully-qualified directory name of where the application should find the data. This directory will be called the "data source directory" in these instructions.
- Find this line:
-
aico_run_incremental.sh
:- Find this line:
docker run --rm --name ${COLLECTION}_state --user $(id -u):$(id -g) -e HOME=/usr/src/app -v ${PWD}:/usr/src/app/ -v /data:/data ${IMAGE} ${COLLECTION}_run_incremental || exit $?
- Replace the
/data/:
portion of the command with the fully-qualified directory name of where the application should find the data.
- Find this line:
-
FITS files archived at CADC are checked with fitsverify
before being stored. This step will update FITS file headers in a file so that the keyword value pairs conform to the fitsverify
check.
-
The data source directory needs to be on a machine with access to Sky Camera Images, and enough disk space to make a copy of the files to be archived.
-
On a machine with write access to the data source directory, run this:
docker run --rm -ti --user $(id -u):$(id -g) -e HOME=/usr/src/app -v ${PWD}:/usr/src/app -v <data source directory>:/data aico2caom2_app /bin/bash -c 'for ii in $(ls /data/*fits); do python /usr/local/bin/aico_weathercam.py ${ii}; done'
This will run the script aico_weathercam.py
for each <file_name.fits>
in /data
.
All <file name.fits>
in the data source directory will be copied to <file name_v.fits>
. The <file name_v.fits>
files should be archived at CADC.
Prepared files should be stored in a separate location for the next step, as aico2caom2
will try to process any files with a .fits
extension.
aicocaom2
may be run so that it processes files incrementally, according to their timestamp on disk, or so that is processes all the files it finds.
-
To run the application incrementally:
./aico_run_incremental.sh
By default, incremental mode will start 24 hours prior to the current execution time. This can be changed by modifying the
state.yml
file content that is created on the first run. -
To run the application on all the files it finds:
./aico_run.sh
-
To debug the application from inside the container, run the following command. Replace the
<data directory here>
with the fully-qualified path name of the directory where the data to be processed is located.user@dockerhost:<cwd># docker run --rm -ti -v ${PWD}:/usr/src/app -v <data directory here>:/data --user $(id -u):$(id -g) -e HOME=/usr/src/app --name aico_run aico2caom2_app /bin/bash cadcops@53bef30d8af3:/usr/src/app# aico_run
-
For some instructions that might be helpful on using containers, see: https://github.com/opencadc/collection2caom2/wiki/Docker-and-Collections
-
For some insight into what's happening, see: https://github.com/opencadc/collection2caom2
-
For Docker information, see: https://www.docker.com