Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/core/components/impl/mysqlstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import logging
import fnmatch
import hashlib
import os

from dynamo.core.components.persistency import InventoryStore
from dynamo.utils.interface.mysql import MySQL
from dynamo.dataformat import Configuration, Partition, Dataset, Block, File, Site, SitePartition, Group, DatasetReplica, BlockReplica
from dynamo.policy.condition import Condition
from dynamo.policy.variables import site_variables

LOG = logging.getLogger(__name__)

Expand All @@ -17,6 +20,16 @@ def __init__(self, config):

self._mysql = MySQL(config.db_params)

config_path = os.getenv('DYNAMO_SERVER_CONFIG', '/etc/dynamo/fom_config.json')

self.fom_config = Configuration(config_path)
self.fom_conditions = []

for condition_text, module, conf in self.fom_config.rlfsm.transfer:
if condition_text is not None: # default
condition = Condition(condition_text, site_variables)
self.fom_conditions.append((condition, module, conf))

def close(self):
self._mysql.close()

Expand Down Expand Up @@ -746,6 +759,10 @@ def _yield_sites(self, sites_tmp = None): #override
sid = site_id
)

for cond, module, conf in self.fom_conditions:
if cond.match(site):
site.x509proxy = conf.x509proxy

all_chains = {}
for protocol, chain_id, idx, lfn, pfn in self._mysql.xquery(mapping_sql, site_id):
try:
Expand Down Expand Up @@ -1119,6 +1136,7 @@ def delete_blockreplica(self, block_replica): #override
return

sql = 'DELETE FROM `block_replicas` WHERE `block_id` = %s AND `site_id` = %s'

self._mysql.query(sql, block_id, site_id)

sql = 'DELETE FROM `block_replica_files` WHERE `block_id` = %s AND `site_id` = %s'
Expand Down
2 changes: 1 addition & 1 deletion lib/policy/producers/weblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_list(self, inventory):
locked = False
locks = source.make_request(lock_url[0].replace('`','"'))
for lock in locks:
if lock == 1:
if lock:
locked = True
break
if not locked:
Expand Down
6 changes: 5 additions & 1 deletion lib/source/impl/phedexreplicainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def get_replicas(self, site = None, dataset = None, block = None): #override
block_entries = self._phedex.make_request('blockreplicas', options, timeout = 7200)

# Removing blocks that have only block_replicas with group None
'''
to_remove = set()

for i,block_entry in enumerate(block_entries):
Expand All @@ -111,7 +112,9 @@ def get_replicas(self, site = None, dataset = None, block = None): #override
for i in sorted(to_remove, reverse=True):
LOG.info("Discarding %s from list of block replicas" % block_entries[i]['name'])
del block_entries[i]


'''

parallelizer = Map()
parallelizer.timeout = 7200

Expand Down Expand Up @@ -420,6 +423,7 @@ def maker_blockreplicas(block, block_entry, site_check = None):
# temporarily make this a list
block_replica.file_ids = []
block_replica.size = 0
LOG.info("Incomplete %s" % str(block_replica))

if 'file' in block_entry:
for file_entry in block_entry['file']:
Expand Down