Skip to content
Snippets Groups Projects
Commit 0fb11c51 authored by Nathan Bockisch's avatar Nathan Bockisch
Browse files

Modified gmva_ingester to copy directories from the GMVA source area to the...

Modified gmva_ingester to copy directories from the GMVA source area to the difx directory so they can be picked up by stackstorm
parent d11c1cef
No related branches found
No related tags found
2 merge requests!1452Merge 2.8.2 to main,!1447Modified gmva_ingester to copy directories from the GMVA source area to the...
Pipeline #11548 passed
# gmva_ingester
`gmva_ingester` is a utility that copies GMVA observation directories from the
GMVA source directory (defined in CAPO) to the VLBI ingestion staging directory
GMVA source directory (defined in CAPO) to the difx directory
(also defined in CAPO). It is not meant to be run by hand, but by a workflow
that facilitates the entire GMVA observation ingestion process.
......@@ -9,5 +9,5 @@ that facilitates the entire GMVA observation ingestion process.
```
Usage of ./gmva_ingester:
-dir string
Name of the GMVA directory within the GMVA source directory to be copied to the VLBI staging directory
Name of the GMVA directory within the GMVA source directory to be copied to the difx directory
```
......@@ -28,7 +28,7 @@ import (
func main() {
var gmvaDir string
flag.StringVar(&gmvaDir, "dir", "", "Name of the GMVA directory within the GMVA source directory to be copied to the VLBI staging directory")
flag.StringVar(&gmvaDir, "dir", "", "Name of the GMVA directory within the GMVA source directory to be copied to the difx directory")
flag.Parse()
if gmvaDir == "" {
......
......@@ -50,9 +50,10 @@ func CopyGmva(dir string) {
capoProperties, err := config.InitConfig(os.Getenv("CAPO_PROFILE"), helpers.DefaultCapoPath)
checkError(err)
ingestionSettings := capoProperties.SettingsForPrefix("edu.nrao.workspaces.IngestionSettings")
gmvaSourcePath := ingestionSettings.GetString("gmvaSourceDirectory")
vlbiStagingPath := ingestionSettings.GetString("vlbiStagingDirectory")
wsIngestionSettings := capoProperties.SettingsForPrefix("edu.nrao.workspaces.IngestionSettings")
gmvaSourcePath := wsIngestionSettings.GetString("gmvaSourceDirectory")
aatIngestionSettings := capoProperties.SettingsForPrefix("archive-ingestion")
difxPath := aatIngestionSettings.GetString("VLBAPath")
// GMVA source only copies files starting with GMVA
gmvaSourceFiles := strings.Join([]string{gmvaSourcePath, dir, "GMVA*"}, "/")
......@@ -60,15 +61,15 @@ func CopyGmva(dir string) {
gmvaSourcePaths, err = filepath.Glob(gmvaSourceFiles)
checkError(err)
vlbiTargetDir := strings.Join([]string{vlbiStagingPath, dir}, "/")
difxDir := strings.Join([]string{difxPath, dir}, "/")
// First make the directory to copy files to
mkdirCmd := exec.Command("mkdir", vlbiTargetDir)
mkdirCmd := exec.Command("mkdir", difxDir)
err = mkdirCmd.Run()
checkError(err)
for _, path := range gmvaSourcePaths {
copyCmd := exec.Command("cp", "-LR", path, vlbiTargetDir)
copyCmd := exec.Command("cp", "-LR", path, difxDir)
err = copyCmd.Run()
checkError(err)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment