Skip to content

Commit b1bbc0d

Browse files
feat: add support for batch processing mode (googleapis#300)
* feat: add support for batch processing mode PiperOrigin-RevId: 523777114 Source-Link: googleapis/googleapis@802cd84 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a73dd054acf304b5bf070a1e65cba6fd158e4105 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTczZGQwNTRhY2YzMDRiNWJmMDcwYTFlNjVjYmE2ZmQxNThlNDEwNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 0f4f8fa commit b1bbc0d

File tree

3 files changed

+54
-13
lines changed

3 files changed

+54
-13
lines changed

google/cloud/video/transcoder_v1/types/resources.py

+39-12
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,10 @@ class Job(proto.Message):
7979
formats <https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats>`__.
8080
template_id (str):
8181
Input only. Specify the ``template_id`` to use for
82-
populating ``Job.config``. The default is ``preset/web-hd``.
82+
populating ``Job.config``. The default is ``preset/web-hd``,
83+
which is the only supported preset.
8384
84-
Preset Transcoder templates:
85-
86-
- ``preset/{preset_id}``
87-
88-
- User defined JobTemplate: ``{job_template_id}``
85+
User defined JobTemplate: ``{job_template_id}``
8986
9087
This field is a member of `oneof`_ ``job_config``.
9188
config (google.cloud.video.transcoder_v1.types.JobConfig):
@@ -114,6 +111,9 @@ class Job(proto.Message):
114111
Output only. An error object that describes the reason for
115112
the failure. This property is always present when ``state``
116113
is ``FAILED``.
114+
mode (google.cloud.video.transcoder_v1.types.Job.ProcessingMode):
115+
The processing mode of the job. The default is
116+
``PROCESSING_MODE_INTERACTIVE``.
117117
"""
118118

119119
class ProcessingState(proto.Enum):
@@ -139,6 +139,24 @@ class ProcessingState(proto.Enum):
139139
SUCCEEDED = 3
140140
FAILED = 4
141141

142+
class ProcessingMode(proto.Enum):
143+
r"""The processing mode of the job.
144+
145+
Values:
146+
PROCESSING_MODE_UNSPECIFIED (0):
147+
The job processing mode is not specified.
148+
PROCESSING_MODE_INTERACTIVE (1):
149+
The job processing mode is interactive mode.
150+
Interactive job will either be ran or rejected
151+
if quota does not allow for it.
152+
PROCESSING_MODE_BATCH (2):
153+
The job processing mode is batch mode.
154+
Batch mode allows queuing of jobs.
155+
"""
156+
PROCESSING_MODE_UNSPECIFIED = 0
157+
PROCESSING_MODE_INTERACTIVE = 1
158+
PROCESSING_MODE_BATCH = 2
159+
142160
name: str = proto.Field(
143161
proto.STRING,
144162
number=1,
@@ -196,6 +214,11 @@ class ProcessingState(proto.Enum):
196214
number=17,
197215
message=status_pb2.Status,
198216
)
217+
mode: ProcessingMode = proto.Field(
218+
proto.ENUM,
219+
number=20,
220+
enum=ProcessingMode,
221+
)
199222

200223

201224
class JobTemplate(proto.Message):
@@ -785,13 +808,13 @@ class NormalizedCoordinate(proto.Message):
785808
)
786809

787810
class Image(proto.Message):
788-
r"""Overlaid jpeg image.
811+
r"""Overlaid image.
789812
790813
Attributes:
791814
uri (str):
792-
Required. URI of the JPEG image in Cloud Storage. For
793-
example, ``gs://bucket/inputs/image.jpeg``. JPEG is the only
794-
supported image type.
815+
Required. URI of the image in Cloud Storage. For example,
816+
``gs://bucket/inputs/image.png``. Only PNG and JPEG images
817+
are supported.
795818
resolution (google.cloud.video.transcoder_v1.types.Overlay.NormalizedCoordinate):
796819
Normalized image resolution, based on output video
797820
resolution. Valid values: ``0.0``–``1.0``. To respect the
@@ -2047,9 +2070,11 @@ class AudioStream(proto.Message):
20472070
The BCP-47 language code, such as ``en-US`` or ``sr-Latn``.
20482071
For more information, see
20492072
https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
2073+
Not supported in MP4 files.
20502074
display_name (str):
20512075
The name for this particular audio stream
2052-
that will be added to the HLS/DASH manifest.
2076+
that will be added to the HLS/DASH manifest. Not
2077+
supported in MP4 files.
20532078
"""
20542079

20552080
class AudioMapping(proto.Message):
@@ -2156,12 +2181,14 @@ class TextStream(proto.Message):
21562181
The BCP-47 language code, such as ``en-US`` or ``sr-Latn``.
21572182
For more information, see
21582183
https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
2184+
Not supported in MP4 files.
21592185
mapping_ (MutableSequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]):
21602186
The mapping for the ``Job.edit_list`` atoms with text
21612187
``EditAtom.inputs``.
21622188
display_name (str):
21632189
The name for this particular text stream that
2164-
will be added to the HLS/DASH manifest.
2190+
will be added to the HLS/DASH manifest. Not
2191+
supported in MP4 files.
21652192
"""
21662193

21672194
class TextMapping(proto.Message):

samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-video-transcoder",
11-
"version": "1.8.2"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/gapic/transcoder_v1/test_transcoder_service.py

+14
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ def test_create_job(request_type, transport: str = "grpc"):
762762
output_uri="output_uri_value",
763763
state=resources.Job.ProcessingState.PENDING,
764764
ttl_after_completion_days=2670,
765+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
765766
template_id="template_id_value",
766767
)
767768
response = client.create_job(request)
@@ -778,6 +779,7 @@ def test_create_job(request_type, transport: str = "grpc"):
778779
assert response.output_uri == "output_uri_value"
779780
assert response.state == resources.Job.ProcessingState.PENDING
780781
assert response.ttl_after_completion_days == 2670
782+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
781783

782784

783785
def test_create_job_empty_call():
@@ -819,6 +821,7 @@ async def test_create_job_async(
819821
output_uri="output_uri_value",
820822
state=resources.Job.ProcessingState.PENDING,
821823
ttl_after_completion_days=2670,
824+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
822825
)
823826
)
824827
response = await client.create_job(request)
@@ -835,6 +838,7 @@ async def test_create_job_async(
835838
assert response.output_uri == "output_uri_value"
836839
assert response.state == resources.Job.ProcessingState.PENDING
837840
assert response.ttl_after_completion_days == 2670
841+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
838842

839843

840844
@pytest.mark.asyncio
@@ -1441,6 +1445,7 @@ def test_get_job(request_type, transport: str = "grpc"):
14411445
output_uri="output_uri_value",
14421446
state=resources.Job.ProcessingState.PENDING,
14431447
ttl_after_completion_days=2670,
1448+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
14441449
template_id="template_id_value",
14451450
)
14461451
response = client.get_job(request)
@@ -1457,6 +1462,7 @@ def test_get_job(request_type, transport: str = "grpc"):
14571462
assert response.output_uri == "output_uri_value"
14581463
assert response.state == resources.Job.ProcessingState.PENDING
14591464
assert response.ttl_after_completion_days == 2670
1465+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
14601466

14611467

14621468
def test_get_job_empty_call():
@@ -1498,6 +1504,7 @@ async def test_get_job_async(
14981504
output_uri="output_uri_value",
14991505
state=resources.Job.ProcessingState.PENDING,
15001506
ttl_after_completion_days=2670,
1507+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
15011508
)
15021509
)
15031510
response = await client.get_job(request)
@@ -1514,6 +1521,7 @@ async def test_get_job_async(
15141521
assert response.output_uri == "output_uri_value"
15151522
assert response.state == resources.Job.ProcessingState.PENDING
15161523
assert response.ttl_after_completion_days == 2670
1524+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
15171525

15181526

15191527
@pytest.mark.asyncio
@@ -3302,6 +3310,7 @@ def test_create_job_rest(request_type):
33023310
}
33033311
],
33043312
},
3313+
"mode": 1,
33053314
}
33063315
request = request_type(**request_init)
33073316

@@ -3314,6 +3323,7 @@ def test_create_job_rest(request_type):
33143323
output_uri="output_uri_value",
33153324
state=resources.Job.ProcessingState.PENDING,
33163325
ttl_after_completion_days=2670,
3326+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
33173327
template_id="template_id_value",
33183328
)
33193329

@@ -3334,6 +3344,7 @@ def test_create_job_rest(request_type):
33343344
assert response.output_uri == "output_uri_value"
33353345
assert response.state == resources.Job.ProcessingState.PENDING
33363346
assert response.ttl_after_completion_days == 2670
3347+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
33373348

33383349

33393350
def test_create_job_rest_required_fields(request_type=services.CreateJobRequest):
@@ -3721,6 +3732,7 @@ def test_create_job_rest_bad_request(
37213732
}
37223733
],
37233734
},
3735+
"mode": 1,
37243736
}
37253737
request = request_type(**request_init)
37263738

@@ -4164,6 +4176,7 @@ def test_get_job_rest(request_type):
41644176
output_uri="output_uri_value",
41654177
state=resources.Job.ProcessingState.PENDING,
41664178
ttl_after_completion_days=2670,
4179+
mode=resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE,
41674180
template_id="template_id_value",
41684181
)
41694182

@@ -4184,6 +4197,7 @@ def test_get_job_rest(request_type):
41844197
assert response.output_uri == "output_uri_value"
41854198
assert response.state == resources.Job.ProcessingState.PENDING
41864199
assert response.ttl_after_completion_days == 2670
4200+
assert response.mode == resources.Job.ProcessingMode.PROCESSING_MODE_INTERACTIVE
41874201

41884202

41894203
def test_get_job_rest_required_fields(request_type=services.GetJobRequest):

0 commit comments

Comments
 (0)