CLI¶
parse_date_time ¶
A helper method to create a date object from a CBERS time stamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date_stamp |
str Example format from CBERS:`2015-12-03 10:40:23`
|
Date in this format: |
required |
Returns:
Type | Description |
---|---|
datetime
|
A python datetime object. |
Source code in ckanext/saeoss/cli/_parse_date_time.py
CKAN CLI commands for the saeoss extension
bootstrap ¶
cbers ¶
cbers(source_path, user, owner_org, test_only_flag=False, verbosity_level=2, halt_on_error_flag=False)
Ingest a collection of CBERS metadata folders.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
test_only_flag |
bool
|
Whether to do a dummy run ( database will not be updated. Default False. |
False
|
source_path |
str
|
A CBERS created CBERS 04 metadata xml file and thumbnail. |
required |
verbosity_level |
int
|
How verbose the logging output should be. 0-2 where 2 is very very very very verbose! Default is 1. |
2
|
halt_on_error_flag |
bool
|
Whather we should stop processing when the first error is encountered. Default is True. |
False
|
ignore_missing_thumbs |
bool
|
Whether we should raise an error if we find we are missing a thumbnails. Default is False. |
required |
Source code in ckanext/saeoss/cli/commands.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 |
|
create_iso_topic_categories ¶
Create ISO Topic Categories.
This command adds a CKAN vocabulary for the ISO Topic Categories and creates each topic category as a CKAN tag.
This command can safely be called multiple times - it will only ever create the vocabulary and themes once.
Source code in ckanext/saeoss/cli/commands.py
create_materialized_view ¶
Create the materialized view used to map between CKAN and pycsw
Source code in ckanext/saeoss/cli/commands.py
create_pages ¶
Create default pages
Source code in ckanext/saeoss/cli/commands.py
create_saeoss_organizations ¶
Create main Saeoss organizations
This command creates the main Saeoss organizations.
This function may fail if the Saeoss organizations already exist but are disabled, which can happen if they are deleted using the CKAN web frontend.
This is a product of a CKAN limitation whereby it is not possible to retrieve a list of organizations regardless of their status - it will only return those that are active.
Source code in ckanext/saeoss/cli/commands.py
create_sample_datasets ¶
create_sample_datasets(owner_org, num_datasets, name_prefix, name_suffix, temporal_range, longitude_range, latitude_range)
Create multiple sample datasets
Source code in ckanext/saeoss/cli/commands.py
create_sample_organizations ¶
Create sample organizations and members
Source code in ckanext/saeoss/cli/commands.py
create_stac_dataset_func ¶
fetch data from a valid stac catalog and create datasets out of stack items
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user |
str
|
authorized user name to create the dataset |
required |
url |
str
|
url of the catalogue |
required |
owner_org |
str
|
Organization where the dataset will belong |
required |
number_records |
int
|
Maximum number of created dataset from STAC items |
10
|
Source code in ckanext/saeoss/cli/commands.py
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 |
|
defer_to_alembic ¶
Run an alembic command
Examples:
defer-to-alembic current --command-kwarg=verbose:true
defer-to-alembic heads --command-kwarg=verbose:true
defer-to-alembic history
Source code in ckanext/saeoss/cli/commands.py
delete_data ¶
delete_pages ¶
Delete default pages
Source code in ckanext/saeoss/cli/commands.py
delete_saeoss_organizations ¶
Delete the main Saeoss organizations.
This command will delete the Saeoss organizations from the CKAN DB - CKAN refers to this as purging the organizations (the CKAN default behavior is to have the delete command simply disable the existing organizations, but keeping them in the DB).
It can safely be called multiple times - it will only ever delete the organizations once.
Source code in ckanext/saeoss/cli/commands.py
delete_sample_datasets ¶
Deletes at most 1000 of existing sample datasets
Source code in ckanext/saeoss/cli/commands.py
delete_sample_organizations ¶
Delete sample organizations.
Source code in ckanext/saeoss/cli/commands.py
delete_sample_users ¶
Delete sample users.
Source code in ckanext/saeoss/cli/commands.py
drop_materialized_view ¶
Delete the materialized view used to map between CKAN and pycsw
Source code in ckanext/saeoss/cli/commands.py
extra_commands ¶
harvesting_dispatcher ¶
Manages the harvesting queue and then sleeps a while after that.
This command takes care of submitting pending jobs and marking done jobs as finished.
It is similar to ckanext.harvest's harvester run
CLI command, with the difference
being that this command is designed to run and then wait a specific amount of time
before exiting. This is a workaround for the fact that it is not possible to
specify a delay period when restarting docker containers in docker-compose's normal
mode.
NOTE: This command is not needed when running under k8s or docker-compose swarm mode, as these offer other ways to control periodic services. In that case you can simply configure the periodic service and then use
launch-ckan-cli harvester run
as the container's CMD instruction.
Source code in ckanext/saeoss/cli/commands.py
ingest ¶
load_sample_data ¶
pycsw ¶
refresh_materialized_view ¶
Refresh the materialized view used to map between CKAN and pycsw
Source code in ckanext/saeoss/cli/commands.py
refresh_pycsw_materialized_view ¶
Refreshes the pycsw materiolized view and then sleeps for a while
This is similar to our own ckan run pycsw refresh-materialized-view
, with the
difference being that this command is designed to run and then wait a specific
amount of time before exiting. This is a workaround for the fact that it is not
possible to specify a delay period when restarting docker containers in
docker-compose's normal mode.
NOTE: This command is not needed when running under k8s or docker-compose swarm mode, as these offer other ways to control periodic services. In that case you can simply configure a periodic service and then use
launch-ckan-cli saeoss pycsw refresh-materizalied-view
as the container's CMD instruction.
Source code in ckanext/saeoss/cli/commands.py
saeoss ¶
Commands related to the saeoss extension.
Source code in ckanext/saeoss/cli/commands.py
send_email_notifications ¶
Send pending email notifications to users
This command should be ran periodically.
Source code in ckanext/saeoss/cli/commands.py
shell ¶
Launch a shell with CKAN already imported and ready to explore
The implementation of this command is mostly inspired and adapted from django's
shell
command
Source code in ckanext/saeoss/cli/commands.py
stac ¶
test_background_job ¶
Run background jobs synchronously
JOB_NAME is the name of the job function to be run. Look in the jobs
module for
existing functions.
Example:
ckan saeoss test-background-job \ notify_org_admins_of_dataset_maintenance_request \ --job-arg=f1733d0c-5188-43b3-8039-d95efb76b4f5