Skip to content

Commit 92cf2ef

Browse files
Docs review (#26)
* fix: removing accounting/entitlements route references after being deleted * feat: refactor of jobs methods
1 parent 4a9a829 commit 92cf2ef

11 files changed

+104
-199
lines changed

CONTRIBUTING.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ Run tests:
138138

139139
- `$ py.test`
140140

141-
//validate this one with Raúl.
142-
143141
Or specify the test that you want to run:
144142

145143
- `$ py.test tests.test_client`

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The code below is applicable for `text/plain` input type.
6161
Submit a job providing the model, version, and input file:
6262

6363
```python
64-
job = client.jobs.submit_files('ed542963de', '0.0.27', {'input.txt': './some-file.txt'})
64+
job = client.jobs.submit_file('ed542963de', '0.0.27', {'input.txt': './some-file.txt'})
6565
```
6666

6767
Hold until the inference is complete and results become available:
@@ -149,14 +149,10 @@ Currently we support the following API routes:
149149
|Update processing engines|client.models.update_processing_engines()|[api/resource/models](https://models.modzy.com/docs/management/processing/set-processing)|
150150
|Get minimum engines|client.models.get_minimum_engines()|[api/models/processing-engines](https://models.modzy.com/docs/management/processing/get-minimum-engines)|
151151
|List tags|client.tags.get_all()|[api/models/tags](https://models.modzy.com/docs/marketplace/tags/retrieve-tags)|
152-
|Submit a Job (Single Text)|client.jobs.submit_text()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-text)|
153-
|Submit a Job (Multiple Text)|client.jobs.submit_text_bulk()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-text)|
154-
|Submit a Job (Single Embedded)|client.jobs.submit_bytes()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-embedded)|
155-
|Submit a Job (Multiple Embedded)|client.jobs.submit_bytes_bulk()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-embedded)|
156-
|Submit a Job (Single File)|client.jobs.submit_files()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
157-
|Submit a Job (Multiple Files)|client.jobs.submit_files_bulk()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
158-
|Submit a Job (Single AWS S3)|client.jobs.submit_aws_s3()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
159-
|Submit a Job (Multiple AWS S3)|client.jobs.submit_aws_s3_bulk()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
152+
|Submit a Job (Text)|client.jobs.submit_text()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-text)|
153+
|Submit a Job (Embedded)|client.jobs.submit_embedded()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-embedded)|
154+
|Submit a Job (File)|client.jobs.submit_file()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
155+
|Submit a Job (AWS S3)|client.jobs.submit_aws_s3()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-aws)|
160156
|Submit a Job (JDBC)|client.jobs.submit_jdbc()|[api/jobs](https://models.modzy.com/docs/jobs/jobs/submit-job-jdbc)|
161157
|Cancel job|job.cancel()|[api/jobs/:job-id](https://models.modzy.com/docs/jobs/jobs/cancel-pending-job) |
162158
|Hold until inference is complete|job.block_until_complete()|[api/jobs/:job-id](https://models.modzy.com/docs/jobs/jobs/retrieve-job-details) |

modzy/_util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,9 @@ def file_to_chunks(file_like, chunk_size):
6565
def bytes_to_chunks(byte_array, chunk_size):
6666
for i in range(0, len(byte_array), chunk_size):
6767
yield byte_array[i:i + chunk_size]
68+
69+
70+
def depth(d):
71+
if d and isinstance(d, dict):
72+
return max(depth(v) for k, v in d.items()) + 1
73+
return 0

modzy/jobs.py

Lines changed: 80 additions & 175 deletions
Large diffs are not rendered by default.

samples/job_with_aws_input_sample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sys.path.insert(0, '..')
1010
from modzy import ApiClient
1111

12-
12+
1313
# Always configure the logger level (ie: DEBUG, INFO, WARNING, ERROR, CRITICAL)
1414
logging.basicConfig(level=logging.INFO)
1515
logger = logging.getLogger(__name__)
@@ -87,7 +87,7 @@
8787
# If you send a correct input key, but a wrong AWS S3 value key, the model fails to process the input.
8888
sources["wrong-value"] = {"image": {'bucket': BUCKET_NAME, 'key': "wrong-aws-file-key.png"}}
8989
# When you have all your inputs ready, you can use our helper method to submit the job as follows:
90-
job = client.jobs.submit_aws_s3_bulk(model.modelId, modelVersion.version, sources, ACCESS_KEY, SECRET_ACCESS_KEY, "us-west-2")
90+
job = client.jobs.submit_aws_s3(model.modelId, modelVersion.version, sources, ACCESS_KEY, SECRET_ACCESS_KEY, "us-west-2")
9191
# Modzy creates the job and queue for processing. The job object contains all the info that you need to keep track
9292
# of the process, the most important being the job identifier and the job status.
9393
logger.info("job: %s", job)

samples/job_with_embedded_input_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
# If you send a correct input key but some wrong values, the model fails too.
8484
sources["wrong-value"] = {"input": config_bytes, "config.json":image_bytes}
8585
# When you have all your inputs ready, you can use our helper method to submit the job as follows:
86-
job = client.jobs.submit_bytes_bulk(model.modelId, modelVersion.version, sources)
86+
job = client.jobs.submit_embedded(model.modelId, modelVersion.version, sources)
8787
# Modzy creates the job and queue for processing. The job object contains all the info that you need to keep track
8888
# of the process, the most important being the job identifier and the job status.
8989
logger.info("job: %s", job)

samples/job_with_file_input_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
# If you send a correct input key but some wrong values, the model fails too.
8585
sources["wrong-value"] = {"input": config_bytes, "config.json":image_bytes}
8686
# When you have all your inputs ready, you can use our helper method to submit the job as follows:
87-
job = client.jobs.submit_files_bulk(model.modelId, modelVersion.version, sources)
87+
job = client.jobs.submit_file(model.modelId, modelVersion.version, sources)
8888
# Modzy creates the job and queue for processing. The job object contains all the info that you need to keep track
8989
# of the process, the most important being the job identifier and the job status.
9090
logger.info("job: %s", job)

samples/job_with_text_input_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
# If you send a wrong input key, the model fails to process the input.
7474
sources["wrong-key"] = {"a.wrong.key": "This input is wrong!"}
7575
# When you have all your inputs ready, you can use our helper method to submit the job as follows:
76-
job = client.jobs.submit_text_bulk(model.modelId, modelVersion.version, sources)
76+
job = client.jobs.submit_text(model.modelId, modelVersion.version, sources)
7777
# Modzy creates the job and queue for processing. The job object contains all the info that you need to keep track
7878
# of the process, the most important being the job identifier and the job status.
7979
logger.info("job: %s", job)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.5.5
2+
current_version = 0.5.6
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
test_suite='tests',
4141
tests_require=test_requirements,
4242
url='https://github.com/modzy/sdk-python',
43-
version='0.5.5',
43+
version='0.5.6',
4444
zip_safe=False,
4545
)

0 commit comments

Comments
 (0)