PREVIEW_ROOT_PATH,SYNC_PATH,SYNC_SERVER
)
from slave_sync_task import (
    update_feature_job,update_metadata_feature_job,db_feature_task_filter,
    gs_style_task_filter,gs_spatial_task_filter
)

logger = logging.getLogger(__name__)


send_layer_preview_task_filter = lambda sync_job: gs_spatial_task_filter(sync_job) and sync_job.get("preview_path")

task_name = lambda sync_job: "{0}:{1}".format(sync_job["workspace"],sync_job["name"])

download_cmd = ["rsync", "-Paz", "-e", BORG_SSH,None,None]
md5_cmd = BORG_SSH.split() + [SYNC_SERVER,"md5sum",None]
local_md5_cmd = ["md5sum",None]

def check_file_md5(md5_cmd,md5,task_status):
    logger.info("Executing {}...".format(repr(md5_cmd)))
    get_md5 = subprocess.Popen(md5_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
    get_md5_output = get_md5.communicate()

    if get_md5_output[1] and get_md5_output[1].strip():
        logger.info("stderr: {}".format(get_md5_output[1]))
        task_status.set_message("message",get_md5_output[1])

    if get_md5.returncode != 0:
        raise Exception("{0}:{1}".format(get_md5.returncode,task_status.get_message("message")))

    file_md5 = get_md5_output[0].split()[0]
    PREVIEW_ROOT_PATH,SYNC_PATH,SYNC_SERVER,
    now
)
from slave_sync_task import (
    update_feature_job,update_metadata_feature_job,db_feature_task_filter,
    gs_style_task_filter,gs_spatial_task_filter,layer_preview_task_filter,
    update_livelayer_job,update_wmslayer_job
)

logger = logging.getLogger(__name__)


task_name = lambda sync_job: "{0}:{1}".format(sync_job["workspace"],sync_job["name"])

download_cmd = ["rsync", "-Paz", "-e", BORG_SSH,None,None]
md5_cmd = BORG_SSH.split() + [None,"md5sum",None]
local_md5_cmd = ["md5sum",None]

def check_file_md5(md5_cmd,md5,task_status):
    logger.info("Executing {}...".format(repr(md5_cmd)))
    get_md5 = subprocess.Popen(md5_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
    get_md5_output = get_md5.communicate()

    if get_md5_output[1] and get_md5_output[1].strip():
        logger.info("stderr: {}".format(get_md5_output[1]))
        task_status.set_message("message",get_md5_output[1])

    if get_md5.returncode != 0:
        raise Exception("{0}:{1}".format(get_md5.returncode,task_status.get_message("message")))

    file_md5 = get_md5_output[0].split()[0]
Example #3
0
    db_feature_task_filter, gs_style_task_filter, gs_spatial_task_filter,
    layer_preview_task_filter, update_wmsstore_job, update_wmslayer_job,
    remove_wmslayer_job, remove_wmsstore_job, update_livestore_job,
    update_livelayer_job, remove_livelayer_job, remove_livestore_job,
    empty_gwc_layer_job, empty_gwc_group_job, empty_gwc_livelayer_job,
    update_feature_job, remove_feature_job, update_feature_metadata_job,
    empty_gwc_feature_job, update_workspace_job)

logger = logging.getLogger(__name__)

task_name = lambda sync_job: "{0}:{1}".format(sync_job["workspace"], sync_job[
    "name"]) if "workspace" in sync_job else (sync_job["name"] if "name" in
                                              sync_job else sync_job["schema"])

download_cmd = ["rsync", "-Paz", "-e", BORG_SSH, None, None]
md5_cmd = BORG_SSH.split() + [None, "md5sum", None]
local_md5_cmd = ["md5sum", None]


def check_file_md5(md5_cmd, md5, task_status=None):
    logger.info("Executing {}...".format(repr(md5_cmd)))
    get_md5 = subprocess.Popen(md5_cmd,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               env=env)
    get_md5_output = get_md5.communicate()

    if get_md5.returncode != 0:
        raise Exception("{0}:{1}".format(get_md5.returncode,
                                         get_md5_output[1]))
    elif get_md5_output[1] and get_md5_output[1].strip():