-
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 #288 from HSF/dev
Dev
- Loading branch information
Showing
21 changed files
with
642 additions
and
63 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
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 - 2023 | ||
# - Wen Guan, <[email protected]>, 2020 - 2024 | ||
|
||
|
||
""" | ||
|
@@ -32,7 +32,7 @@ | |
|
||
|
||
from idds.common.authentication import OIDCAuthentication, OIDCAuthenticationUtils | ||
from idds.common.utils import setup_logging, get_proxy_path | ||
from idds.common.utils import setup_logging, get_proxy_path, idds_mask | ||
|
||
from idds.client.version import release_version | ||
from idds.client.client import Client | ||
|
@@ -444,6 +444,13 @@ def submit(self, workflow, username=None, userdn=None, use_dataset_name=False): | |
priority = workflow.priority | ||
if priority is None: | ||
priority = 0 | ||
elif workflow.type in [WorkflowType.iWorkflowLocal]: | ||
scope = 'iworkflowLocal' | ||
request_type = RequestType.iWorkflowLocal | ||
transform_tag = workflow.get_work_tag() | ||
priority = workflow.priority | ||
if priority is None: | ||
priority = 0 | ||
except Exception: | ||
pass | ||
|
||
|
@@ -621,6 +628,24 @@ def abort_task(self, request_id=None, workload_id=None, task_id=None): | |
ret = self.client.abort_request_task(request_id=request_id, workload_id=workload_id, task_id=task_id) | ||
return ret | ||
|
||
@exception_handler | ||
def close(self, request_id=None, workload_id=None): | ||
""" | ||
Close requests. | ||
:param workload_id: the workload id. | ||
:param request_id: the request. | ||
""" | ||
self.setup_client() | ||
|
||
if request_id is None and workload_id is None: | ||
logging.error("Both request_id and workload_id are None. One of them should not be None") | ||
return (-1, "Both request_id and workload_id are None. One of them should not be None") | ||
|
||
ret = self.client.close_request(request_id=request_id, workload_id=workload_id) | ||
# return (-1, 'No matching requests') | ||
return ret | ||
|
||
@exception_handler | ||
def retry(self, request_id=None, workload_id=None): | ||
""" | ||
|
@@ -840,3 +865,17 @@ def update_build_request(self, request_id, signature, workflow): | |
self.setup_client() | ||
|
||
return self.client.update_build_request(request_id=request_id, signature=signature, workflow=workflow) | ||
|
||
@exception_handler | ||
def get_metainfo(self, name): | ||
""" | ||
Get meta info. | ||
:param name: the name of the meta info. | ||
""" | ||
self.setup_client() | ||
|
||
logging.info("Retrieving meta info for %s" % (name)) | ||
ret = self.client.get_metainfo(name=name) | ||
logging.info("Retrieved meta info for %s: %s" % (name, idds_mask(ret))) | ||
return ret |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# You may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0OA | ||
# | ||
# Authors: | ||
# - Wen Guan, <[email protected]>, 2024 | ||
|
||
|
||
""" | ||
Metainfo Rest client to access IDDS system. | ||
""" | ||
|
||
import os | ||
|
||
from idds.client.base import BaseRestClient | ||
|
||
|
||
class MetaInfoClient(BaseRestClient): | ||
|
||
"""MetaInfo Rest client""" | ||
|
||
METAINFO_BASEURL = 'metainfo' | ||
|
||
def __init__(self, host=None, auth=None, timeout=None): | ||
""" | ||
Constructor of the BaseRestClient. | ||
:param host: the address of the IDDS server. | ||
:param client_proxy: the client certificate proxy. | ||
:param timeout: timeout in seconds. | ||
""" | ||
super(MetaInfoClient, self).__init__(host=host, auth=auth, timeout=timeout) | ||
|
||
def get_metainfo(self, name): | ||
""" | ||
Get meta info | ||
:param name: name to select different meta info | ||
:raise exceptions if it's not got successfully. | ||
""" | ||
path = self.METAINFO_BASEURL | ||
url = self.build_url(self.host, path=os.path.join(path, str(name))) | ||
|
||
meta_info = self.get_request_response(url, type='GET') | ||
return meta_info |
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
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
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
Oops, something went wrong.