Skip to content

Commit

Permalink
Upload python SDK version (#1335)
Browse files Browse the repository at this point in the history
* Upload 0.0.4 SDK version

* Fix doc links

* Fix links in README

* Modify tables

* Fix link

* Remove

* Modify client and gen script

* Update version to 0.0.5

* Run CI

* Add Katib client to init
  • Loading branch information
andreyvelich authored Sep 15, 2020
1 parent 4b11f80 commit 721a382
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 217 deletions.
23 changes: 21 additions & 2 deletions hack/gen-python-sdk/post_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ def _rewrite_helper(input_file, output_file, rewrite_rules):
for rule in rules:
line = rule(line)
lines.append(line)

# Add Katib client to init file
if (output_file == "sdk/python/v1beta1/kubeflow/katib/__init__.py" or
output_file == "sdk/python/v1alpha3/kubeflow/katib/__init__.py"):
lines.append("\n")
lines.append("# Import Katib API client")
lines.append("\n")
lines.append("from kubeflow.katib.api.katib_client import KatibClient")
lines.append("\n")

with open(output_file, 'w') as f:
f.writelines(lines)

Expand Down Expand Up @@ -56,9 +66,11 @@ def update_python_sdk(src, dest, versions=('v1alpha3', 'v1beta1')):
continue
_rewrite_helper(in_file, out_file, rewrite_rules)

# update doc for API Endpoints and Models README.md
# Update doc for Models README.md
buffer = []
update_buffer = []

# Get data from generated doc
with open(os.path.join(src, 'README.md'), 'r') as src_f:
anchor = 0
for line in src_f.readlines():
Expand All @@ -71,7 +83,14 @@ def update_python_sdk(src, dest, versions=('v1alpha3', 'v1beta1')):
continue
if anchor == 2:
break
# Remove leading space from the list
if len(line) > 0:
line = line.lstrip(" ")
update_buffer.append(line)
# Remove latest redundant newline
update_buffer = update_buffer[:-1]

# Update README with new models
with open(os.path.join(dest, 'README.md'), 'r') as dest_f:
anchor = 0
for line in dest_f.readlines():
Expand All @@ -87,7 +106,7 @@ def update_python_sdk(src, dest, versions=('v1alpha3', 'v1beta1')):
with open(os.path.join(dest, 'README.md'), 'w') as dest_f:
dest_f.writelines(buffer)

# clear working dictionary
# Clear working dictionary
shutil.rmtree(src)


Expand Down
77 changes: 38 additions & 39 deletions sdk/python/v1alpha3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,44 @@ Class | Method | Description

## Documentation For Models

- [V1alpha3AlgorithmSetting](docs/V1alpha3AlgorithmSetting.md)
- [V1alpha3AlgorithmSpec](docs/V1alpha3AlgorithmSpec.md)
- [V1alpha3CollectorSpec](docs/V1alpha3CollectorSpec.md)
- [V1alpha3EarlyStoppingSetting](docs/V1alpha3EarlyStoppingSetting.md)
- [V1alpha3EarlyStoppingSpec](docs/V1alpha3EarlyStoppingSpec.md)
- [V1alpha3Experiment](docs/V1alpha3Experiment.md)
- [V1alpha3ExperimentCondition](docs/V1alpha3ExperimentCondition.md)
- [V1alpha3ExperimentList](docs/V1alpha3ExperimentList.md)
- [V1alpha3ExperimentSpec](docs/V1alpha3ExperimentSpec.md)
- [V1alpha3ExperimentStatus](docs/V1alpha3ExperimentStatus.md)
- [V1alpha3FeasibleSpace](docs/V1alpha3FeasibleSpace.md)
- [V1alpha3FileSystemPath](docs/V1alpha3FileSystemPath.md)
- [V1alpha3FilterSpec](docs/V1alpha3FilterSpec.md)
- [V1alpha3GoTemplate](docs/V1alpha3GoTemplate.md)
- [V1alpha3GraphConfig](docs/V1alpha3GraphConfig.md)
- [V1alpha3Metric](docs/V1alpha3Metric.md)
- [V1alpha3MetricsCollectorSpec](docs/V1alpha3MetricsCollectorSpec.md)
- [V1alpha3NasConfig](docs/V1alpha3NasConfig.md)
- [V1alpha3ObjectiveSpec](docs/V1alpha3ObjectiveSpec.md)
- [V1alpha3Observation](docs/V1alpha3Observation.md)
- [V1alpha3Operation](docs/V1alpha3Operation.md)
- [V1alpha3OptimalTrial](docs/V1alpha3OptimalTrial.md)
- [V1alpha3ParameterAssignment](docs/V1alpha3ParameterAssignment.md)
- [V1alpha3ParameterSpec](docs/V1alpha3ParameterSpec.md)
- [V1alpha3SourceSpec](docs/V1alpha3SourceSpec.md)
- [V1alpha3Suggestion](docs/V1alpha3Suggestion.md)
- [V1alpha3SuggestionCondition](docs/V1alpha3SuggestionCondition.md)
- [V1alpha3SuggestionList](docs/V1alpha3SuggestionList.md)
- [V1alpha3SuggestionSpec](docs/V1alpha3SuggestionSpec.md)
- [V1alpha3SuggestionStatus](docs/V1alpha3SuggestionStatus.md)
- [V1alpha3TemplateSpec](docs/V1alpha3TemplateSpec.md)
- [V1alpha3Trial](docs/V1alpha3Trial.md)
- [V1alpha3TrialAssignment](docs/V1alpha3TrialAssignment.md)
- [V1alpha3TrialCondition](docs/V1alpha3TrialCondition.md)
- [V1alpha3TrialList](docs/V1alpha3TrialList.md)
- [V1alpha3TrialSpec](docs/V1alpha3TrialSpec.md)
- [V1alpha3TrialStatus](docs/V1alpha3TrialStatus.md)
- [V1alpha3TrialTemplate](docs/V1alpha3TrialTemplate.md)

- [V1alpha3AlgorithmSetting](docs/V1alpha3AlgorithmSetting.md)
- [V1alpha3AlgorithmSpec](docs/V1alpha3AlgorithmSpec.md)
- [V1alpha3CollectorSpec](docs/V1alpha3CollectorSpec.md)
- [V1alpha3EarlyStoppingSetting](docs/V1alpha3EarlyStoppingSetting.md)
- [V1alpha3EarlyStoppingSpec](docs/V1alpha3EarlyStoppingSpec.md)
- [V1alpha3Experiment](docs/V1alpha3Experiment.md)
- [V1alpha3ExperimentCondition](docs/V1alpha3ExperimentCondition.md)
- [V1alpha3ExperimentList](docs/V1alpha3ExperimentList.md)
- [V1alpha3ExperimentSpec](docs/V1alpha3ExperimentSpec.md)
- [V1alpha3ExperimentStatus](docs/V1alpha3ExperimentStatus.md)
- [V1alpha3FeasibleSpace](docs/V1alpha3FeasibleSpace.md)
- [V1alpha3FileSystemPath](docs/V1alpha3FileSystemPath.md)
- [V1alpha3FilterSpec](docs/V1alpha3FilterSpec.md)
- [V1alpha3GoTemplate](docs/V1alpha3GoTemplate.md)
- [V1alpha3GraphConfig](docs/V1alpha3GraphConfig.md)
- [V1alpha3Metric](docs/V1alpha3Metric.md)
- [V1alpha3MetricsCollectorSpec](docs/V1alpha3MetricsCollectorSpec.md)
- [V1alpha3NasConfig](docs/V1alpha3NasConfig.md)
- [V1alpha3ObjectiveSpec](docs/V1alpha3ObjectiveSpec.md)
- [V1alpha3Observation](docs/V1alpha3Observation.md)
- [V1alpha3Operation](docs/V1alpha3Operation.md)
- [V1alpha3OptimalTrial](docs/V1alpha3OptimalTrial.md)
- [V1alpha3ParameterAssignment](docs/V1alpha3ParameterAssignment.md)
- [V1alpha3ParameterSpec](docs/V1alpha3ParameterSpec.md)
- [V1alpha3SourceSpec](docs/V1alpha3SourceSpec.md)
- [V1alpha3Suggestion](docs/V1alpha3Suggestion.md)
- [V1alpha3SuggestionCondition](docs/V1alpha3SuggestionCondition.md)
- [V1alpha3SuggestionList](docs/V1alpha3SuggestionList.md)
- [V1alpha3SuggestionSpec](docs/V1alpha3SuggestionSpec.md)
- [V1alpha3SuggestionStatus](docs/V1alpha3SuggestionStatus.md)
- [V1alpha3TemplateSpec](docs/V1alpha3TemplateSpec.md)
- [V1alpha3Trial](docs/V1alpha3Trial.md)
- [V1alpha3TrialAssignment](docs/V1alpha3TrialAssignment.md)
- [V1alpha3TrialCondition](docs/V1alpha3TrialCondition.md)
- [V1alpha3TrialList](docs/V1alpha3TrialList.md)
- [V1alpha3TrialSpec](docs/V1alpha3TrialSpec.md)
- [V1alpha3TrialStatus](docs/V1alpha3TrialStatus.md)
- [V1alpha3TrialTemplate](docs/V1alpha3TrialTemplate.md)

## Documentation For Authorization

Expand Down
3 changes: 3 additions & 0 deletions sdk/python/v1alpha3/kubeflow/katib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@
from kubeflow.katib.models.v1alpha3_trial_spec import V1alpha3TrialSpec
from kubeflow.katib.models.v1alpha3_trial_status import V1alpha3TrialStatus
from kubeflow.katib.models.v1alpha3_trial_template import V1alpha3TrialTemplate

# Import Katib API client
from kubeflow.katib.api.katib_client import KatibClient
130 changes: 75 additions & 55 deletions sdk/python/v1beta1/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Kubeflow Katib SDK
# Kubeflow Katib SDK

Python SDK for Kubeflow Katib

Expand Down Expand Up @@ -27,74 +27,94 @@ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
python setup.py install --user
```

(or `sudo python setup.py install` to install the package for all users)

### Upload new version to PyPi

Our SDK is located in [`kubeflow-katib` PyPi package](https://pypi.org/project/kubeflow-katib/).
If you want to release new SDK version with updated API you have to ask anyone from
[OWNERS](https://github.com/kubeflow/katib/blob/master/OWNERS) file to follow these steps:

- Update version in [`setup.py`](https://github.com/kubeflow/katib/blob/master/sdk/python/v1beta1/setup.py#L22)

- Generate distributive packages: `python3 setup.py sdist bdist_wheel`

- Upload package to PyPi: `twine upload dist/*`

## Getting Started

Please follow the [examples](examples) to learn more about Katib SDK.

## Documentation for API Endpoints

Class | Method | Description
------------ | ------------- | -------------
[KatibClient](docs/KatibClient.md) | [create_experiment](docs/KatibClient.md#create_experiment) | Create Katib Experiment|
[KatibClient](docs/KatibClient.md) | [get_experiment](docs/KatibClient.md#get_experiment) | Get or watch the specified Experiment or all Experiment in the namespace |
[KatibClient](docs/KatibClient.md) | [delete_experiment](docs/KatibClient.md#delete_experiment) | Delete specified Experiment |
[KatibClient](docs/KatibClient.md) | [list_experiments](docs/KatibClient.md#list_experiments) | List all Experiments with status |
[KatibClient](docs/KatibClient.md) | [get_experiment_status](docs/KatibClient.md#get_experiment_status) | Get Experiment status|
[KatibClient](docs/KatibClient.md) | [is_experiment_succeeded](docs/KatibClient.md#is_experiment_succeeded) | Check if Experiment status is Succeeded |
[KatibClient](docs/KatibClient.md) | [list_trials](docs/KatibClient.md#list_trials) | List all trials of specified Experiment |
[KatibClient](docs/KatibClient.md) | [get_optimal_hyperparmeters](docs/KatibClient.md#get_optimal_hyperparmeters) | Get currentOptimalTrial with paramaterAssignments of an Experiment|

| Class | Method | Description |
| --------------------- | ------------------------------------- | ------------------------------------------------------------------------ |
| [KatibClient][client] | [create_experiment][create] | Create Katib Experiment |
| [KatibClient][client] | [get_experiment][get_e] | Get or watch the specified Experiment or all Experiment in the namespace |
| [KatibClient][client] | [delete_experiment][delete] | Delete specified Experiment |
| [KatibClient][client] | [list_experiments][list_e] | List all Experiments with status |
| [KatibClient][client] | [get_experiment_status][get_status] | Get Experiment status |
| [KatibClient][client] | [is_experiment_succeeded][is_suc] | Check if Experiment status is Succeeded |
| [KatibClient][client] | [list_trials][list_t] | List all Trials of specified Experiment |
| [KatibClient][client] | [get_optimal_hyperparameters][opt_hp] | Get currentOptimalTrial with parameterAssignments of an Experiment |

[client]: docs/KatibClient.md
[create]: docs/KatibClient.md#create_experiment
[get_e]: docs/KatibClient.md#get_experiment
[delete]: docs/KatibClient.md#delete_experiment
[list_e]: docs/KatibClient.md#list_experiments
[get_status]: docs/KatibClient.md#get_experiment_status
[is_suc]: docs/KatibClient.md#is_experiment_succeeded
[list_t]: docs/KatibClient.md#list_trials
[opt_hp]: docs/KatibClient.md#get_optimal_hyperparameters

## Documentation For Models

- [V1beta1AlgorithmSetting](docs/V1beta1AlgorithmSetting.md)
- [V1beta1AlgorithmSpec](docs/V1beta1AlgorithmSpec.md)
- [V1beta1CollectorSpec](docs/V1beta1CollectorSpec.md)
- [V1beta1ConfigMapSource](docs/V1beta1ConfigMapSource.md)
- [V1beta1EarlyStoppingSetting](docs/V1beta1EarlyStoppingSetting.md)
- [V1beta1EarlyStoppingSpec](docs/V1beta1EarlyStoppingSpec.md)
- [V1beta1Experiment](docs/V1beta1Experiment.md)
- [V1beta1ExperimentCondition](docs/V1beta1ExperimentCondition.md)
- [V1beta1ExperimentList](docs/V1beta1ExperimentList.md)
- [V1beta1ExperimentSpec](docs/V1beta1ExperimentSpec.md)
- [V1beta1ExperimentStatus](docs/V1beta1ExperimentStatus.md)
- [V1beta1FeasibleSpace](docs/V1beta1FeasibleSpace.md)
- [V1beta1FileSystemPath](docs/V1beta1FileSystemPath.md)
- [V1beta1FilterSpec](docs/V1beta1FilterSpec.md)
- [V1beta1GraphConfig](docs/V1beta1GraphConfig.md)
- [V1beta1Metric](docs/V1beta1Metric.md)
- [V1beta1MetricStrategy](docs/V1beta1MetricStrategy.md)
- [V1beta1MetricsCollectorSpec](docs/V1beta1MetricsCollectorSpec.md)
- [V1beta1NasConfig](docs/V1beta1NasConfig.md)
- [V1beta1ObjectiveSpec](docs/V1beta1ObjectiveSpec.md)
- [V1beta1Observation](docs/V1beta1Observation.md)
- [V1beta1Operation](docs/V1beta1Operation.md)
- [V1beta1OptimalTrial](docs/V1beta1OptimalTrial.md)
- [V1beta1ParameterAssignment](docs/V1beta1ParameterAssignment.md)
- [V1beta1ParameterSpec](docs/V1beta1ParameterSpec.md)
- [V1beta1SourceSpec](docs/V1beta1SourceSpec.md)
- [V1beta1Suggestion](docs/V1beta1Suggestion.md)
- [V1beta1SuggestionCondition](docs/V1beta1SuggestionCondition.md)
- [V1beta1SuggestionList](docs/V1beta1SuggestionList.md)
- [V1beta1SuggestionSpec](docs/V1beta1SuggestionSpec.md)
- [V1beta1SuggestionStatus](docs/V1beta1SuggestionStatus.md)
- [V1beta1Trial](docs/V1beta1Trial.md)
- [V1beta1TrialAssignment](docs/V1beta1TrialAssignment.md)
- [V1beta1TrialCondition](docs/V1beta1TrialCondition.md)
- [V1beta1TrialList](docs/V1beta1TrialList.md)
- [V1beta1TrialParameterSpec](docs/V1beta1TrialParameterSpec.md)
- [V1beta1TrialSource](docs/V1beta1TrialSource.md)
- [V1beta1TrialSpec](docs/V1beta1TrialSpec.md)
- [V1beta1TrialStatus](docs/V1beta1TrialStatus.md)
- [V1beta1TrialTemplate](docs/V1beta1TrialTemplate.md)

- [V1beta1AlgorithmSetting](docs/V1beta1AlgorithmSetting.md)
- [V1beta1AlgorithmSpec](docs/V1beta1AlgorithmSpec.md)
- [V1beta1CollectorSpec](docs/V1beta1CollectorSpec.md)
- [V1beta1ConfigMapSource](docs/V1beta1ConfigMapSource.md)
- [V1beta1EarlyStoppingSetting](docs/V1beta1EarlyStoppingSetting.md)
- [V1beta1EarlyStoppingSpec](docs/V1beta1EarlyStoppingSpec.md)
- [V1beta1Experiment](docs/V1beta1Experiment.md)
- [V1beta1ExperimentCondition](docs/V1beta1ExperimentCondition.md)
- [V1beta1ExperimentList](docs/V1beta1ExperimentList.md)
- [V1beta1ExperimentSpec](docs/V1beta1ExperimentSpec.md)
- [V1beta1ExperimentStatus](docs/V1beta1ExperimentStatus.md)
- [V1beta1FeasibleSpace](docs/V1beta1FeasibleSpace.md)
- [V1beta1FileSystemPath](docs/V1beta1FileSystemPath.md)
- [V1beta1FilterSpec](docs/V1beta1FilterSpec.md)
- [V1beta1GraphConfig](docs/V1beta1GraphConfig.md)
- [V1beta1Metric](docs/V1beta1Metric.md)
- [V1beta1MetricStrategy](docs/V1beta1MetricStrategy.md)
- [V1beta1MetricsCollectorSpec](docs/V1beta1MetricsCollectorSpec.md)
- [V1beta1NasConfig](docs/V1beta1NasConfig.md)
- [V1beta1ObjectiveSpec](docs/V1beta1ObjectiveSpec.md)
- [V1beta1Observation](docs/V1beta1Observation.md)
- [V1beta1Operation](docs/V1beta1Operation.md)
- [V1beta1OptimalTrial](docs/V1beta1OptimalTrial.md)
- [V1beta1ParameterAssignment](docs/V1beta1ParameterAssignment.md)
- [V1beta1ParameterSpec](docs/V1beta1ParameterSpec.md)
- [V1beta1SourceSpec](docs/V1beta1SourceSpec.md)
- [V1beta1Suggestion](docs/V1beta1Suggestion.md)
- [V1beta1SuggestionCondition](docs/V1beta1SuggestionCondition.md)
- [V1beta1SuggestionList](docs/V1beta1SuggestionList.md)
- [V1beta1SuggestionSpec](docs/V1beta1SuggestionSpec.md)
- [V1beta1SuggestionStatus](docs/V1beta1SuggestionStatus.md)
- [V1beta1Trial](docs/V1beta1Trial.md)
- [V1beta1TrialAssignment](docs/V1beta1TrialAssignment.md)
- [V1beta1TrialCondition](docs/V1beta1TrialCondition.md)
- [V1beta1TrialList](docs/V1beta1TrialList.md)
- [V1beta1TrialParameterSpec](docs/V1beta1TrialParameterSpec.md)
- [V1beta1TrialSource](docs/V1beta1TrialSource.md)
- [V1beta1TrialSpec](docs/V1beta1TrialSpec.md)
- [V1beta1TrialStatus](docs/V1beta1TrialStatus.md)
- [V1beta1TrialTemplate](docs/V1beta1TrialTemplate.md)

## Documentation For Authorization

All endpoints do not require authorization.

All endpoints do not require authorization.

## Author

Expand Down
Loading

0 comments on commit 721a382

Please sign in to comment.