def main(product): dc = Datacube(app="wms_update_ranges") if (product is not None): print("Updating range for: ", product) update_range(dc, product) else: print("Updating ranges for all layers/products") p, u, i, sp, su, si = update_all_ranges(dc) print( "Updated ranges for %d existing layers/products and inserted ranges for %d new layers/products (%d existing layers/products unchanged)" % (u, i, p)) if sp or su or si: print( "Updated ranges for %d existing sub-products and inserted ranges for %d new sub-products (%d existing sub-products unchanged)" % (su, si, sp))
def main(product, calculate_extent): dc = Datacube(app="wms_update_ranges") if not calculate_extent and product is None: print("Updating range for all, using SQL extent calculation") add_all(dc) print("Done") elif product is not None: print("Updating range for: ", product) update_range(dc, product) else: print("Updating ranges for all layers/products") p, u, i, sp, su, si = update_all_ranges(dc) print( "Updated ranges for %d existing layers/products and inserted ranges for %d new layers/products (%d existing layers/products unchanged)" % (u, i, p)) if sp or su or si: print( "Updated ranges for %d existing sub-products and inserted ranges for %d new sub-products (%d existing sub-products unchanged)" % (su, si, sp))
from datacube_wms.product_ranges import update_all_ranges from datacube_wms.cube_pool import get_cube, release_cube if __name__ == "__main__": app="wms_update" dc = get_cube(app=app) passed, updated, inserted = update_all_ranges(dc) release_cube(dc, app=app) print ("%d existing products unchanged" % passed) print ("%d existing products updated" % updated) print ("%d new products inserted" % inserted)
def main(product, multiproduct, merge_only, calculate_extent, schema, role): """Manage datacube-ows range tables. A valid invocation should specify at most one of '--product', '--multiproduct' or '--schema'. If neither of these options are specified, then the ranges for all products and multiproducts are updated. """ if product and multiproduct: print( "Sorry, you specified both a product and multiproduct. One at a time, please." ) return 1 elif schema and (product or multiproduct): print( "Sorry, cannot update the schema and ranges in the same invocation." ) return 1 elif schema and not role: print("Sorry, cannot update schema without specifying a role") return 1 if os.environ.get("PYDEV_DEBUG"): import pydevd_pycharm pydevd_pycharm.settrace('172.17.0.1', port=12321, stdoutToServer=True, stderrToServer=True) dc = Datacube(app="wms_update_ranges") if schema: print("Checking schema....") print("Creating or replacing WMS database schema...") create_schema(dc, role) print("Done") elif not calculate_extent: if product: print("Updating range for: ", product) add_product_range(dc, product) elif multiproduct: print("Updating range for: ", multiproduct) add_multiproduct_range(dc, multiproduct) else: print("Updating range for all, using SQL extent calculation") add_all(dc) print("Done") else: if product: print("Updating range for: ", product) p, u, i, sp, su, si = update_range(dc, product, multi=False) if u: print("Ranges updated for", product) elif i: print("New ranges inserted for", product) else: print("Ranges up to date for", product) if sp or su or si: print( "Updated ranges for %d existing sub-products and inserted ranges for %d new sub-products (%d existing sub-products unchanged)" % (su, si, sp)) elif multiproduct: print("Updating range for: ", multiproduct) p, u, i = update_range(dc, multiproduct, multi=True, follow_dependencies=not merge_only) if u: print("Merged ranges updated for", multiproduct) elif i: print("Merged ranges inserted for", multiproduct) else: print("Merged ranges up to date for", multiproduct) else: print("Updating ranges for all layers/products") p, u, i, sp, su, si, mp, mu, mi = update_all_ranges(dc) print( "Updated ranges for %d existing layers/products and inserted ranges for %d new layers/products (%d existing layers/products unchanged)" % (u, i, p)) if sp or su or si: print( "Updated ranges for %d existing sub-products and inserted ranges for %d new sub-products (%d existing sub-products unchanged)" % (su, si, sp)) if mp or mu or mi: print( "Updated ranges for %d existing multi-products and inserted ranges for %d new multi-products (%d existing multi-products unchanged)" % (su, si, sp)) return 0
from __future__ import absolute_import, division, print_function from datacube_wms.product_ranges import update_all_ranges from datacube_wms.cube_pool import get_cube, release_cube # pylint: disable=invalid-name if __name__ == "__main__": app = "wms_update" dc = get_cube(app=app) passed, updated, inserted, sub_passed, sub_updated, sub_inserted = update_all_ranges( dc) release_cube(dc, app=app) print("%d existing products unchanged" % passed) print("%d existing products updated" % updated) print("%d new products inserted" % inserted) if sub_updated or sub_inserted or sub_passed: print("%d existing sub-products unchanged" % sub_passed) print("%d existing sub-products updated" % sub_updated) print("%d new sub-products inserted" % sub_inserted)
from datacube_wms.product_ranges import update_all_ranges from datacube import Datacube if __name__ == '__main__': dc = Datacube(app="wms_update_ranges") print ("Updating ranges for all layers/products") p, u, i, sp, su, si = update_all_ranges(dc) print ("Updated ranges for %d existing layers/products and inserted ranges for %d new layers/products (%d existing layers/products unchanged)" % (u, i, p)) if sp or su or si: print ("Updated ranges for %d existing sub-products and inserted ranges for %d new sub-products (%d existing sub-products unchanged)" % (su, si, sp))
from datacube_wms.product_ranges import update_all_ranges from datacube import Datacube if __name__ == '__main__': dc = Datacube(app="wms_update_ranges") print("Updating ranges for all layers/products") p, u, i = update_all_ranges(dc) print( "Updated ranges for %d existing layers/products and inserted ranges for %d new layers/products (%d existing layers/products unchanged)" % (u, i, p))