-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from HSF/dev
improve eventbus and add coordinator
- Loading branch information
Showing
64 changed files
with
4,120 additions
and
693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# http://www.apache.org/licenses/LICENSE-2.0OA | ||
# | ||
# Authors: | ||
# - Wen Guan, <[email protected]>, 2020 - 2022 | ||
# - Wen Guan, <[email protected]>, 2020 - 2023 | ||
|
||
|
||
try: | ||
|
@@ -47,6 +47,7 @@ def __init__(self, task_parameters=None, | |
# maxwalltime=90000, maxattempt=5, core_count=1, | ||
# encode_command_line=False, | ||
num_retries=5, | ||
use_rucio=False, | ||
# task_log=None, | ||
# task_cloud=None, | ||
# task_rss=0 | ||
|
@@ -84,6 +85,7 @@ def __init__(self, task_parameters=None, | |
self.retry_number = 0 | ||
self.num_retries = num_retries | ||
|
||
self.use_rucio = use_rucio | ||
self.load_panda_urls() | ||
|
||
def my_condition(self): | ||
|
@@ -155,6 +157,8 @@ def set_agent_attributes(self, attrs, req_attributes=None): | |
super(ATLASPandaWork, self).set_agent_attributes(attrs) | ||
if self.agent_attributes and 'num_retries' in self.agent_attributes and self.agent_attributes['num_retries']: | ||
self.num_retries = int(self.agent_attributes['num_retries']) | ||
if self.class_name in attrs and 'use_rucio' in attrs[self.class_name]: | ||
self.use_rucio = attrs[self.class_name]['use_rucio'] | ||
|
||
def parse_task_parameters(self, task_parameters): | ||
if self.task_parameters: | ||
|
@@ -307,17 +311,18 @@ def poll_external_collection(self, coll): | |
else: | ||
try: | ||
if not coll.coll_type == CollectionType.PseudoDataset: | ||
client = self.get_rucio_client() | ||
did_meta = client.get_metadata(scope=coll.scope, name=coll.name) | ||
|
||
coll.coll_metadata['bytes'] = did_meta['bytes'] | ||
coll.coll_metadata['total_files'] = did_meta['length'] | ||
coll.coll_metadata['availability'] = did_meta['availability'] | ||
coll.coll_metadata['events'] = did_meta['events'] | ||
coll.coll_metadata['is_open'] = did_meta['is_open'] | ||
coll.coll_metadata['run_number'] = did_meta['run_number'] | ||
coll.coll_metadata['did_type'] = did_meta['did_type'] | ||
coll.coll_metadata['list_all_files'] = False | ||
if self.use_rucio: | ||
client = self.get_rucio_client() | ||
did_meta = client.get_metadata(scope=coll.scope, name=coll.name) | ||
|
||
coll.coll_metadata['bytes'] = did_meta['bytes'] | ||
coll.coll_metadata['total_files'] = did_meta['length'] | ||
coll.coll_metadata['availability'] = did_meta['availability'] | ||
coll.coll_metadata['events'] = did_meta['events'] | ||
coll.coll_metadata['is_open'] = did_meta['is_open'] | ||
coll.coll_metadata['run_number'] = did_meta['run_number'] | ||
coll.coll_metadata['did_type'] = did_meta['did_type'] | ||
coll.coll_metadata['list_all_files'] = False | ||
|
||
if 'is_open' in coll.coll_metadata and not coll.coll_metadata['is_open']: | ||
coll_status = CollectionStatus.Closed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# http://www.apache.org/licenses/LICENSE-2.0OA | ||
# | ||
# Authors: | ||
# - Wen Guan, <[email protected]>, 2019 - 2022 | ||
# - Wen Guan, <[email protected]>, 2019 - 2023 | ||
|
||
""" | ||
Constants. | ||
|
@@ -32,6 +32,8 @@ class Sections: | |
Consumer = 'consumer' | ||
EventBus = 'eventbus' | ||
Cache = 'cache' | ||
Archiver = 'archiver' | ||
Coordinator = 'coordinator' | ||
|
||
|
||
class HTTP_STATUS_CODE: | ||
|
@@ -288,13 +290,20 @@ class ContentStatus(IDDSEnum): | |
Mapped = 7 | ||
FakeAvailable = 8 | ||
Missing = 9 | ||
Cancelled = 10 | ||
|
||
|
||
class ContentLocking(IDDSEnum): | ||
Idle = 0 | ||
Locking = 1 | ||
|
||
|
||
class ContentFetchStatus(IDDSEnum): | ||
New = 0 | ||
Fetching = 1 | ||
Fetched = 2 | ||
|
||
|
||
class GranularityType(IDDSEnum): | ||
File = 0 | ||
Event = 1 | ||
|
@@ -338,6 +347,12 @@ class ProcessingLocking(IDDSEnum): | |
Locking = 1 | ||
|
||
|
||
class HealthStatus(IDDSEnum): | ||
Default = 0 | ||
InActive = 1 | ||
Active = 2 | ||
|
||
|
||
class MessageType(IDDSEnum): | ||
StageInFile = 0 | ||
StageInCollection = 1 | ||
|
@@ -469,6 +484,12 @@ class CommandLocation(IDDSEnum): | |
Other = 6 | ||
|
||
|
||
class ReturnCode(IDDSEnum): | ||
Ok = 0 | ||
Failed = 255 | ||
Locked = 1 | ||
|
||
|
||
def get_work_status_from_transform_processing_status(status): | ||
if status in [ProcessingStatus.New, TransformStatus.New]: | ||
return WorkStatus.New | ||
|
Oops, something went wrong.