Skip to content

Commit 5c7e51d

Browse files
authored
Merge pull request #34 from Exabyte-io/feature/SOF-7327
update: add owner_id to create
2 parents 0df104c + c395b50 commit 5c7e51d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

exabyte_api_client/endpoints/entity.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ def update(self, id_, modifier):
7676
"""
7777
return self.request("PATCH", "/".join((self.name, id_)), data=json.dumps(modifier), headers=self.headers)
7878

79-
def create(self, config):
79+
def create(self, config, owner_id=None):
8080
"""
8181
Creates a new entity.
8282
8383
Args:
8484
config (dict): entity config.
85+
owner_id (str): owner ID. Entity is created under user's default account if not specified.
8586
8687
Returns:
8788
dict: new entity.
8889
"""
90+
if owner_id:
91+
config["owner"] = {"_id": owner_id}
8992
return self.request("PUT", "/".join((self.name, "create")), data=json.dumps(config), headers=self.headers)
9093

9194
def copy(self, id_):

exabyte_api_client/endpoints/jobs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,20 @@ def get_compute(self, cluster, ppn=1, nodes=1, queue="D", time_limit="01:00:00",
110110
"arguments": {},
111111
}
112112

113-
def create_by_ids(self, materials, workflow_id, project_id, owner_id, prefix, compute=None):
113+
def create_by_ids(self, materials, workflow_id, project_id, prefix, owner_id=None, compute=None):
114114
"""
115115
Creates jobs from the given materials
116116
117117
Args:
118118
materials (list[dict]): list of materials.
119119
workflow_id (str): workflow ID.
120120
project_id (str): project ID.
121-
owner_id (str): owner ID.
122-
compute (dict): compute configuration.
123121
prefix (str): job prefix.
122+
owner_id (str, optional): owner ID.
123+
compute (dict, optional): compute configuration.
124124
125125
Returns:
126-
list
126+
list: List of created jobs.
127127
"""
128128
jobs = []
129129
for material in materials:

0 commit comments

Comments
 (0)