def project(ctx, projectid, snic_api_credentials=None, statusdb_config=None, order_portal=None, pi_email=None, sensitive=True, hard_stage_only=False, add_user=None, fc_delivery=False): """ Deliver the specified projects to the specified destination """ for pid in projectid: if not ctx.parent.params['cluster']: # Soft stage case d = _deliver.ProjectDeliverer( pid, **ctx.parent.params) elif ctx.parent.params['cluster'] == 'grus': # Hard stage and deliver if statusdb_config == None: logger.error("--statusdb-config or env variable $STATUS_DB_CONFIG need to be set to perform GRUS delivery") return 1 load_yaml_config(statusdb_config.name) if snic_api_credentials == None: logger.error("--snic-api-credentials or env variable $SNIC_API_STOCKHOLM need to be set to perform GRUS delivery") return 1 load_yaml_config(snic_api_credentials.name) if order_portal == None: logger.error("--order-portal or env variable $ORDER_PORTAL need to be set to perform GRUS delivery") return 1 load_yaml_config(order_portal.name) d = _deliver_grus.GrusProjectDeliverer( projectid=pid, pi_email=pi_email, sensitive=sensitive, hard_stage_only=hard_stage_only, add_user=list(set(add_user)), fcid=fc_delivery, **ctx.parent.params) if fc_delivery: _exec_fn(d, d.deliver_run_folder) else: _exec_fn(d, d.deliver_project)
def project(ctx, projectid, snic_api_credentials=None, statusdb_config=None, order_portal=None, pi_email=None, sensitive=True, hard_stage_only=False): """ Deliver the specified projects to the specified destination """ if ctx.parent.params['cluster'] == 'bianca': if len(projectid) > 1: logger.error( "Only one project can be specified when delivering to Bianca. Specficied {} projects" .format(len(projectid))) return 1 for pid in projectid: if ctx.parent.params['cluster'] == 'milou': d = _deliver.ProjectDeliverer(pid, **ctx.parent.params) elif ctx.parent.params['cluster'] == 'mosler': d = _deliver_mosler.MoslerProjectDeliverer(pid, **ctx.parent.params) elif ctx.parent.params['cluster'] == 'bianca': d = _deliver_castor.CastorProjectDeliverer(pid, **ctx.parent.params) elif ctx.parent.params['cluster'] == 'grus': if statusdb_config == None: logger.error( "--statusdb-config or env variable $STATUS_DB_CONFIG need to be set to perform GRUS delivery" ) return 1 taca.utils.config.load_yaml_config(statusdb_config) if snic_api_credentials == None: logger.error( "--snic-api-credentials or env variable $SNIC_API_STOCKHOLM need to be set to perform GRUS delivery" ) return 1 taca.utils.config.load_yaml_config(snic_api_credentials) if order_portal == None: logger.error( "--order-portal or env variable $ORDER_PORTAL need to be set to perform GRUS delivery" ) return 1 taca.utils.config.load_yaml_config(order_portal) d = _deliver_grus.GrusProjectDeliverer( projectid=pid, pi_email=pi_email, sensitive=sensitive, hard_stage_only=hard_stage_only, **ctx.parent.params) _exec_fn(d, d.deliver_project)
def check_status(ctx, projectid, snic_api_credentials=None, statusdb_config=None): """In grus delivery mode checks the status of an onggoing delivery """ for pid in projectid: if statusdb_config == None: logger.error("--statusdb-config or env variable $STATUS_DB_CONFIG need to be set to perform GRUS delivery") return 1 taca.utils.config.load_yaml_config(statusdb_config) if snic_api_credentials == None: logger.error("--snic-api-credentials or env variable $SNIC_API_STOCKHOLM need to be set to perform GRUS delivery") return 1 taca.utils.config.load_yaml_config(snic_api_credentials) d = _deliver_grus.GrusProjectDeliverer( pid, **ctx.parent.params) d.check_mover_delivery_status()