Package: sdap-ingest-manager
SDAP manager for ingestion of datasetsPrerequisitespython 3Install anaconda for python 3. From the graphic install for example for macos:https://www.anaconda.com/distribution/#macosgit lfs (for development)Git lfs for the deployment from git, seehttps://git-lfs.github.com/If not available you have to get netcdf files for test, if you do need the tests.Deployed nexus on kubernetes clusterSee projecthttps://github.com/apache/incubator-sdap-nexus$ helm install nexus .  --namespace=sdap --dependency-update -f ~/overridden-nexus-values.ymlInstall, Configure and runInstallStay logged in as user$ pip install sdap-ingest-managerConfigure the ingestion systemCatch the message at the end of the installation output--------------------------------------------------------------
Now, create configuration files in
***/<some path>>/.sdap_ingest_manager***
 Use templates and examples provided there
--------------------------------------------------------------If the path does not show in the installation stdout, you can find it with the command:python -c "import sys; print(f'{sys.prefix}/.sdap_ingest_manager')"Use the path shown in the message and create your own configuration files:$ cd /<some path>>/.sdap_ingest_manager
$ cp sdap_ingest_manager.ini.default sdap_ingest_manager.iniEdit and update the newly created files by following instructions in the comments.Note that the.ini.defaultfile will be used if no value is configured in the.inifile. So you can have a simplified.inifile with only your specific configuration.
Don't put your specific configuration in the.ini.defaultfile, it will be replaced when you upgrade the package.Example of a simplified.inifile:[COLLECTIONS_YAML_CONFIG]yaml_file = collections.yml[OPTIONS]# set to False to actually call the ingestion command for each granuledry_run = False# set to True to automatically list the granules as seen on the nfs server when they are mounted on the local file system.deconstruct_nfs = True# number of parallel ingestion pods on kubernetes (1 per granule)parallel_pods = 2[INGEST]# kubernetes namespace where the sdap cluster is deployedkubernetes_namespace = nexus-devConfigure the collectionsYou can configure it in a local yaml file referenced in thesdap_ingest_manager.inifile.It can also be in a google spreadsheet.If both are configured, the local yaml file will be used.Run the ingestionOn the list of the configured collections:$ run_collectionsThe number of parallel jobs can be updated during the process in thesdap_ingest_manager.inifile.If interrupted (killed) the process will restart where it was.For developersdeploy project$ bash
$ git clone ...
$ cd sdap_ingest_manager
$ python -m venv venv
$ source ./venv/bin/activate
$ pip install .Note the command pip install -e . does not work as it does not deploy the configuration files.Update the projectUpdate the code and the test with your favorite IDE (e.g. pyCharm).Test and create the packageA package based on the dev branch is automatically published at github release when a push is made.Change version in file setup.py$ python setup.py test
$ git tag <version>
$ git push origin <version>The release will be automatically pushed to pypi through github action.ContainerizationDocker(development version)cd containers/docker
docker build --no-cache --tag tloubrieu/sdap-ingest-manager:latest .    
docker run -it --name sdap-ingest-manager -v sdap_ingest_config:/usr/local/.sdap_ingest_manager tloubrieu/sdap-ingest-manager:latest
docker volume inspect sdap_ingest_configYou can see the configuration files in the directory of the named volume (for example /var/lib/docker/volumes/sdap_ingest_config/_data).Note on macos, to access this directory, you need to go inside the Virtual Machine which runs docker service. To update the configuration on macos:docker run --rm -it -v /:/vm-root alpine:edge /bin/ash
cd /vm-root/var/lib/docker/volumes/sdap_ingest_config/_data
cp sdap_ingest_manager.ini.default sdap_ingest_manager.ini
vi sdap_ingest_manager.iniTo publish the docker image on dockerhub do (step necessary for kubernetes deployment):docker login
docker push tloubrieu/sdap-ingest-manager:latestKubernetesCreate the configMap for your deploymentPrepare a configMap from existing native config files:kubectl create configmap collection-ingester-config --from-file=venv/.sdap_ingest_manager -n sdapOptionally you can update the configMap manually if the one you started from is not what you needed:kubectl get configmap collection-ingester-config -o yaml -n sdap > containers/kubernetes/sdap_ingester_config.ymlManually edit the yml file to only keep the configuration which is specific to the deployment (if different from the current one)Replace the configmap:kubectl delete configmap collection-ingester-config -n sdap
kubectl apply -f containers/kubernetes/sdap_ingester_config.yml -n sdapLaunch the servicekubectl apply -f containers/kubernetes/job.yml -n sdapDelete the service:kubectl delete jobs --all -n sdap