Skip to content

Commit

Permalink
Merge pull request #23051: Fixes RunInference test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chamikaramj authored Sep 7, 2022
2 parents de35279 + 62dd4b4 commit c78fc9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ public PythonExternalTransform<InputT, OutputT> withOutputCoder(Coder<?> outputC
* @return updated wrapper for the cross-language transform.
*/
public PythonExternalTransform<InputT, OutputT> withExtraPackages(List<String> extraPackages) {
if (extraPackages.isEmpty()) {
return this;
}
Preconditions.checkState(
Strings.isNullOrEmpty(expansionService),
"Extra packages only apply to auto-started expansion service.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public RunInference<OutputT> withKwarg(String key, Object arg) {
/**
* Specifies any extra Pypi packages required by the RunInference model handler.
*
* <p>This should only be specified when using the default expansion service, i.e. when not using
* {@link #withExpansionService(String)} to provide an expansion service.
*
* <p>For model handlers provided by Beam Python SDK, the implementation will automatically try to
* infer correct packages needed, so this may be omitted.
*
Expand Down Expand Up @@ -192,7 +195,7 @@ public PCollection<OutputT> expand(PCollection<?> input) {
outputCoder = (Coder<OutputT>) KvCoder.of(keyCoder, RowCoder.of(schema));
}

if (this.extraPackages.isEmpty()) {
if (this.expansionService.isEmpty() && this.extraPackages.isEmpty()) {
this.extraPackages.addAll(inferExtraPackagesFromModelHandler());
}

Expand Down

0 comments on commit c78fc9a

Please sign in to comment.