Beispiel #1
0
from rabbit_niersc import Rabbit
from conf.auth import auth_data, host, vhost_name

credentials = auth_data["cordelia"]

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="agent",
           name="S1_zip",
           data_type="S1_zip")


def forward_message(**msg):
    """
    Always use the same kwarg names as defined in the structure of JSON-message.
    On function call kwarg values will be assigned according to received message.
    The following kwargs are available:
        - msg["time"]
        - msg["source_data"]
        - msg["out_dir"]
        - msg["options"]
    """
    payload = {
        "time": msg["time"],
        "source_data": msg["source_data"],
        "out_dir": msg["out_dir"],
        "options": msg["options"]
    }
    r.say(payload)
Beispiel #2
0
from rabbit_niersc import Rabbit
from conf.auth import auth_data, host, vhost_name
from S1L1Tools import S1L1Tools

credentials = auth_data["ophelia"]

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="unit",
           name="S1RenderUnit",
           data_type="S1_zip")


def render(**msg):
    """
    Always use the same kwarg names as defined in the structure of JSON-message.
    On function call kwarg values will be assigned according to received message.
    The following kwargs are available:
        - msg["time"]
        - msg["source_data"]
        - msg["out_dir"]
        - msg["options"]
    """
    result = None
    try:
        source_data = msg["source_data"]
        out_dir = msg["out_dir"]
        s = S1L1Tools(out_dir + source_data)
        s.render(out_dir, ["HH"])
    except TypeError:
Beispiel #3
0
from rabbit_niersc import Rabbit
from datetime import datetime
from conf.auth import auth_data, host, vhost_name
from conf.auth import db_auth_data, db_host, db_name, db_table
from conf.auth import storage
from S1L1Tools import S1L1Tools
from utils.MonitoringUtils import *  # allows using its functions without prefixing them with the module name. But be aware of namespace collisions!

credentials = auth_data["cordelia"]
data_type = "S1_zip"  # this will be the routing key for our messages

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="master",
           name="S1ZipMonUnit",
           data_type=data_type)


new_products = seek_new_products(storage, "S1*.zip", db_host, db_name, db_auth_data[0], db_auth_data[1], db_table)

for product in new_products:
    s = S1L1Tools(os.path.join(storage, product))
    extent = s.metadata['foot_print']
    geojson_name = os.path.join(storage, product + "_extent.geojson")
    save_extent_as_geojson(extent, geojson_name)

    # inserts metadata in DB:
    with open(os.path.join(storage, product + "_extent.geojson")) as f:
        data = json.load(f)
        db_insert_geojson(db_host, db_name, db_auth_data[0], db_auth_data[1], db_table, product, "S1_zip", data)
from rabbit_niersc import Rabbit
from datetime import datetime
from conf.auth import auth_data, host, vhost_name
from conf.auth import db_auth_data, db_host, db_name, db_table
from conf.auth import storage
from utils.MonitoringUtils import *  # allows using its functions without prefixing them with the module name. But be aware of namespace collisions!

credentials = auth_data["cordelia"]
data_type = "S1_render"  # this will be the routing key for our messages

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="master",
           name="monitoring_unit_render",
           data_type=data_type)

new_products = seek_new_products(storage, "niersc_s1_*_render.tif", db_host,
                                 db_name, db_auth_data[0], db_auth_data[1],
                                 db_table)

for product in new_products:
    payload = {
        "time": str(datetime.now().time()),
        "source_data": product,
        "out_dir": storage,
        "options": None
    }
    print "Generated message: %s" % payload
    r.say(payload)
Beispiel #5
0
from rabbit_niersc import Rabbit
from conf.auth import auth_data, host, vhost_name
import shutil

credentials = auth_data["ophelia"]

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="unit",
           name="S1NGWUnit",
           data_type="S1_render")


def publish(**msg):
    """
    Always use the same kwarg names as defined in the structure of JSON-message.
    On function call kwarg values will be assigned according to received message.
    The following kwargs are available:
        - msg["time"]
        - msg["source_data"]
        - msg["out_dir"]
        - msg["options"]
    """
    result = None
    try:
        source_data = msg["source_data"]
        out_dir = msg["out_dir"]
        shutil.copy2(out_dir + source_data, out_dir + "NGW/" + source_data)
    except TypeError:
        pass
Beispiel #6
0
"""
Receives: file name of Sentinel-1 zip-archived product.
Produces: GeoTiff(s)
"""
from rabbit_niersc import Rabbit
from conf.auth import auth_data, host, vhost_name
from S1L1Tools import S1L1Tools
import os.path

credentials = auth_data["ophelia"]

r = Rabbit(credentials=credentials,
           host=host,
           vhost_name=vhost_name,
           profession="unit",
           name="S1UnzipUnit",
           data_type="S1_zip")


def unpack(**msg):
    """
    Always use the same kwarg names as defined in the structure of JSON-message.
    On function call kwarg values will be assigned according to received message.
    The following kwargs are available:
        - msg["time"]
        - msg["source_data"]
        - msg["out_dir"]
        - msg["options"]
    """
    try:
        source_data = msg["source_data"]