Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 74a9fce

Browse files
authored
'v7.x alpha' rebased onto 'master minus black' (#260)
Update python-pachyderm for Pachyderm 2.0
1 parent 9d60ea8 commit 74a9fce

File tree

110 files changed

+11363
-86977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+11363
-86977
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ env:
1515
global:
1616
- PATH=$HOME/cached-deps:$PATH
1717
jobs:
18-
# Most recent releases of the last two minor releases of Pachyderm
19-
- PACHYDERM_VERSION=1.12.5
20-
- PACHYDERM_VERSION=1.13.0
18+
- PACHYDERM_VERSION=2.0.0-alpha.12
2119

2220
jobs:
2321
include:
2422
# other tests
2523
- python: 3.8
2624
env:
2725
- TOXENV=lint
28-
- PACHYDERM_VERSION=1.13.0
26+
- PACHYDERM_VERSION=2.0.0-alpha.12
2927
- python: 3.8
3028
env:
3129
- TOXENV=examples
32-
- PACHYDERM_VERSION=1.13.0
30+
- PACHYDERM_VERSION=2.0.0-alpha.12
3331
install:
3432
- make ci-install
3533
before_script:

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ src/python_pachyderm/proto: docker-build-proto
2323
cd proto/pachyderm && \
2424
git fetch --all && \
2525
git checkout v$(PACHYDERM_VERSION)
26-
find ./proto/pachyderm/src/client -regex ".*\.proto" \
26+
find ./proto/pachyderm/ -regex ".*\.proto" \
2727
| grep -v 'internal' \
2828
| xargs tar cf - \
2929
| docker run -i pachyderm_python_proto \
3030
| tar xf -
31-
mv src/python_pachyderm/client src/python_pachyderm/proto
31+
mv src/python_pachyderm/src src/python_pachyderm/proto
3232
find src/python_pachyderm/proto -type d -exec touch {}/__init__.py \;
3333

3434
init:
@@ -61,4 +61,4 @@ lint:
6161
flake8 src/python_pachyderm --exclude=src/python_pachyderm/proto --max-line-length=120 --max-doc-length=80
6262
PYTHONPATH=./src:$(PYTHONPATH) etc/proto_lint/proto_lint.py
6363

64-
.PHONY: docker-build-proto init ci-install ci-setup release lint
64+
.PHONY: docs docker-build-proto init ci-install ci-setup release lint

docs/python_pachyderm.html

Lines changed: 5507 additions & 7534 deletions
Large diffs are not rendered by default.

etc/proto_lint/proto_lint.py

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
Service.DEBUG: mixin.debug.DebugMixin,
2424
Service.ENTERPRISE: mixin.enterprise.EnterpriseMixin,
2525
Service.HEALTH: mixin.health.HealthMixin,
26+
Service.IDENTITY: mixin.identity.IdentityMixin,
27+
Service.LICENSE: mixin.license.LicenseMixin,
2628
Service.PFS: mixin.pfs.PFSMixin,
2729
Service.PPS: mixin.pps.PPSMixin,
2830
Service.TRANSACTION: mixin.transaction.TransactionMixin,
@@ -66,23 +68,34 @@
6668
"build_commit",
6769
"put_tar",
6870
"get_tar",
69-
# ignore storage v2 for now
70-
"get_tar_conditional_v2",
71-
"file_operation_v2",
72-
"list_file_v2",
73-
"glob_file_v2",
74-
"get_tar_v2",
75-
"walk_file_v2",
76-
"inspect_file_v2",
77-
"clear_commit_v2",
78-
"diff_file_v2",
71+
"activate_auth",
72+
# TODO: add these new API methods
73+
"renew_fileset",
74+
"squash_commit",
75+
"clear_commit",
76+
"modify_file",
77+
"add_fileset",
78+
"get_fileset",
79+
"create_fileset",
7980
],
8081
Service.PPS: [
8182
# the following are ignored because they're for internal use only
8283
"activate_auth",
8384
"create_job",
8485
"update_job_state",
8586
],
87+
Service.AUTH: [
88+
"get_auth_token",
89+
"extend_auth_token",
90+
],
91+
Service.ENTERPRISE: [
92+
# internal RPC only
93+
"heartbeat",
94+
],
95+
Service.LICENSE: [
96+
# internal RPC only
97+
"heartbeat",
98+
],
8699
}
87100

88101
# Mapping of what the linter would by default expect a proto name to be, to
@@ -91,7 +104,7 @@
91104
Service.AUTH: {
92105
"activate": ["activate_auth"],
93106
"deactivate": ["deactivate_auth"],
94-
"authenticate": ["authenticate_github", "authenticate_oidc", "authenticate_one_time_password"],
107+
"authenticate": ["authenticate_oidc"],
95108
"get_a_c_l": ["get_acl"],
96109
"set_a_c_l": ["set_acl"],
97110
"get_o_i_d_c_login": ["get_oidc_login"],
@@ -106,6 +119,23 @@
106119
"get_state": ["get_enterprise_state"],
107120
"deactivate": ["deactivate_enterprise"],
108121
},
122+
Service.LICENSE: {
123+
"activate": ["activate_license"],
124+
"delete_all": ["delete_all_license"],
125+
},
126+
Service.IDENTITY: {
127+
"get_i_d_p_connector": ["get_idp_connector"],
128+
"delete_i_d_p_connector": ["delete_idp_connector"],
129+
"list_i_d_p_connectors": ["list_idp_connectors"],
130+
"create_i_d_p_connector": ["create_idp_connector"],
131+
"update_i_d_p_connector": ["update_idp_connector"],
132+
"get_o_i_d_c_client": ["get_oidc_client"],
133+
"delete_o_i_d_c_client": ["delete_oidc_client"],
134+
"list_o_i_d_c_clients": ["list_oidc_clients"],
135+
"create_o_i_d_c_client": ["create_oidc_client"],
136+
"update_o_i_d_c_client": ["update_oidc_client"],
137+
"delete_all": ["delete_all_identity"],
138+
},
109139
Service.PFS: {
110140
"put_file": ["put_file_bytes", "put_file_url"],
111141
},
@@ -132,27 +162,7 @@
132162
# * We can also specify that a method has an argument that isn't in the
133163
# protos: `(None, "ignored_arg_name")`
134164
RENAMED_ARGS = {
135-
# admin
136-
"extract_pipeline": [
137-
("pipeline", "pipeline_name"),
138-
],
139-
"extract": [
140-
("URL", "url"),
141-
],
142-
"restore": [
143-
(("op", "URL"), "requests"),
144-
],
145165
# auth
146-
"authenticate_github": [
147-
("one_time_password", None),
148-
("oidc_state", None),
149-
("id_token", None),
150-
],
151-
"authenticate_one_time_password": [
152-
("github_token", None),
153-
("oidc_state", None),
154-
("id_token", None),
155-
],
156166
"authenticate_oidc": [
157167
("github_token", None),
158168
("one_time_password", None),

proto/pachyderm

Submodule pachyderm updated 2695 files

proto/run

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
1-
#!/bin/sh
1+
#!/bin/sh -x
22

33
tar xf /dev/stdin
44

55
OUTDIR=src/python_pachyderm/
66
mkdir -p $OUTDIR
77

8-
for i in $(find ./proto/pachyderm/src/client -name "*.proto"); do \
8+
for i in $(find ./proto/pachyderm/src -name "*.proto"); do \
99
# Make sure to remove the gogoproto line, as that is go specific
1010
sed -i s/import.*gogo.proto.*\;// $i
1111
sed -i 's/\[.*gogoproto.*\]//' $i
1212
# We need to do this in a pass before compilation because it's not guaranteed we
1313
# traverse the proto files in order of dependence
1414
done
1515

16-
# skip pkg because protos in there aren't part of the public API
17-
for i in $(find ./proto/pachyderm/src/client -name "*.proto" | grep -v "proto/pachyderm/src/client/pkg"); do \
18-
python3 -m grpc_tools.protoc -I./proto/pachyderm/src --python_out=$OUTDIR --grpc_python_out=$OUTDIR ${i}; \
16+
# fix imports to be relative to src/
17+
for i in $(find ./proto/pachyderm/src -name "*.proto" | grep -v "proto/pachyderm/src/internal"); do \
18+
perl -pi.bak -e 's/import "((?!google).*)"/import "src\/$1"/' $i
19+
done
20+
21+
# skip pkg and server because protos in there aren't part of the public API
22+
for i in $(find ./proto/pachyderm/src -name "*.proto" | grep -v "proto/pachyderm/src/internal" | grep -v 'proto/pachyderm/src/server'); do \
23+
python3 -m grpc_tools.protoc -I./proto/pachyderm --python_out=$OUTDIR --grpc_python_out=$OUTDIR ${i}; \
1924
done
2025

2126
for i in $(find $OUTDIR -regex ".*pb2.*py"); do
2227
# Fix the imports so they work once this is packaged by pypi
23-
sed -i 's/from client\./from python_pachyderm\.proto\./' $i
28+
sed -i 's/from src\./from python_pachyderm\.proto\./' $i
2429
done
2530

2631

src/python_pachyderm/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import enum as _enum
44
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper as _EnumTypeWrapper
55

6-
from .mixin.pfs import PFSFile, PutFileClient
6+
from .mixin.pfs import PFSFile, ModifyFileClient
77
from .client import Client, ConfigError, BadClusterDeploymentID
88
from .spout import SpoutManager, SpoutCommit
99
from .util import put_files, create_python_pipeline, parse_json_pipeline_spec, parse_dict_pipeline_spec
@@ -18,7 +18,7 @@
1818
"put_files",
1919
"create_python_pipeline",
2020
"PFSFile",
21-
"PutFileClient",
21+
"ModifyFileClient",
2222
"parse_json_pipeline_spec",
2323
"parse_dict_pipeline_spec",
2424
"ConfigError",
@@ -88,3 +88,5 @@ def should_import(key):
8888
_import_protos("python_pachyderm.proto.admin.admin_pb2")
8989
_import_protos("python_pachyderm.proto.auth.auth_pb2")
9090
_import_protos("python_pachyderm.proto.enterprise.enterprise_pb2")
91+
_import_protos("python_pachyderm.proto.license.license_pb2")
92+
_import_protos("python_pachyderm.proto.identity.identity_pb2")

src/python_pachyderm/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from .mixin.debug import DebugMixin
99
from .mixin.enterprise import EnterpriseMixin
1010
from .mixin.health import HealthMixin
11+
from .mixin.identity import IdentityMixin
12+
from .mixin.license import LicenseMixin
1113
from .mixin.pfs import PFSMixin
1214
from .mixin.pps import PPSMixin
1315
from .mixin.transaction import TransactionMixin
@@ -40,6 +42,8 @@ class Client(
4042
DebugMixin,
4143
EnterpriseMixin,
4244
HealthMixin,
45+
IdentityMixin,
46+
LicenseMixin,
4347
PFSMixin,
4448
PPSMixin,
4549
TransactionMixin,

src/python_pachyderm/mixin/admin.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,8 @@
11
from python_pachyderm.proto.admin import admin_pb2_grpc as admin_grpc
2-
from python_pachyderm.proto.pps import pps_pb2 as pps_proto
32
from python_pachyderm.service import Service
43

54

65
class AdminMixin:
7-
def extract(self,
8-
url=None, no_objects=None, no_repos=None, no_pipelines=None,
9-
no_auth=None, no_enterprise=None):
10-
"""
11-
Extracts cluster data for backup. Yields `Op` objects.
12-
13-
Params:
14-
15-
* `url`: An optional string specifying an object storage URL. If set,
16-
data will be extracted to this URL rather than returned.
17-
* `no_objects`: An optional bool. If true, will cause extract to omit
18-
objects (and tags.)
19-
* `no_repos`: An optional bool. If true, will cause extract to omit
20-
repos, commits and branches.
21-
* `no_pipelines`: An optional bool. If true, will cause extract to
22-
omit pipelines.
23-
* `no_auth`: An optional bool. If true, will cause extract to omit
24-
acls, tokens, etc.
25-
* `no_enterprise`: An optional bool. If true, will cause extract to
26-
omit any enterprise activation key (which may break auth restore)
27-
"""
28-
return self._req(
29-
Service.ADMIN, "Extract",
30-
URL=url or "",
31-
no_objects=no_objects, no_repos=no_repos, no_pipelines=no_pipelines,
32-
no_auth=no_auth, no_enterprise=no_enterprise,
33-
)
34-
35-
def extract_pipeline(self, pipeline_name):
36-
"""
37-
Extracts a pipeline for backup. Returns an `Op` object.
38-
39-
Params:
40-
41-
* `pipeline_name`: A string representing a pipeline name to extract.
42-
"""
43-
return self._req(
44-
Service.ADMIN, "ExtractPipeline",
45-
pipeline=pps_proto.Pipeline(name=pipeline_name) if pipeline_name is not None else None,
46-
)
47-
48-
def restore(self, requests):
49-
"""
50-
Restores a cluster.
51-
52-
Params:
53-
54-
* `requests`: A generator of `RestoreRequest` objects.
55-
"""
56-
return self._req(Service.ADMIN, "Restore", req=requests)
576

587
def inspect_cluster(self):
598
"""

0 commit comments

Comments
 (0)