diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..47b17aa2 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,142 @@ +name: flux operator tag and release + +on: + workflow_dispatch: + inputs: + release_tag: + description: Custom release tag + type: string + required: true + +jobs: + build-arm: + runs-on: ubuntu-latest + name: make and build arm + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Set tag + run: | + echo "Tag for release is ${{ inputs.release_tag }}" + echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} + - uses: actions/setup-go@v3 + with: + go-version: ^1.18.1 + - name: GHCR Login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Add custom buildx ARM builder + run: | + docker buildx create --name armbuilder + docker buildx use armbuilder + docker buildx inspect --bootstrap + + - name: Deploy Container + env: + tag: ${{ env.tag }} + run: make arm-deploy ARMIMG=ghcr.io/flux-framework/flux-operator:${tag}-arm + + build: + runs-on: ubuntu-latest + strategy: + matrix: + command: [bundle, catalog, docker] + name: make and build ${{ matrix.command }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ^1.18.1 + - name: Set tag + run: | + echo "Tag for release is ${{ inputs.release_tag }}" + echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} + - name: GHCR Login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Container + env: + tag: ${{ env.tag }} + run: | + image=ghcr.io/flux-framework/flux-operator-${{ matrix.command }}:v${tag} + img=ghcr.io/flux-framework/flux-operator:v${tag} + make ${{ matrix.command }}-build BUNDLE_IMG=${image} IMG=${img} CATALOG_IMG=${image} + + - name: Deploy Container + env: + tag: ${{ env.tag }} + run: | + image=ghcr.io/flux-framework/flux-operator-${{ matrix.command }}:v${tag} + img=ghcr.io/flux-framework/flux-operator:v${tag} + make ${{ matrix.command }}-push BUNDLE_IMG=${image} IMG=${img} CATALOG_IMG=${image} + + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ^1.18.1 + - name: Set tag + run: | + echo "Tag for release is ${{ inputs.release_tag }}" + echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} + - name: Install + run: conda create --quiet --name fo twine + - name: Install dependencies + run: | + export PATH="/usr/share/miniconda/bin:$PATH" + source activate fo + pip install -e . + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USER }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} + tag: ${{ env.tag }} + run: | + export PATH="/usr/share/miniconda/bin:$PATH" + source activate fo + cd sdk/python/v1alpha1/ + python setup.py sdist bdist_wheel + cd dist + wheelfile=$(ls fluxoperator-*.whl) + wheelfile=$(echo "$wheelfile" | sed "s/fluxoperator-//") + wheelfile=$(echo "$wheelfile" | sed "s/-py3-none-any.whl//") + echo "Release for Python is ${wheelfile}" + echo "Release for flux operator is ${tag}" + if [[ "${wheelfile}" == "${tag}" ]]; then + echo "Versions are correct, publishing." + twine upload dist/* + else + echo "Versions are not correct, please fix and upload locally." + fi + + - name: Build release manifests + env: + tag: ${{ env.tag }} + run: | + make build-config-arm ARMIMG=ghcr.io/flux-framework/flux-operator:${tag}-arm + make build-config IMG=ghcr.io/flux-framework/flux-operator:v${tag} + - name: Release Flux Operator + uses: softprops/action-gh-release@v1 + with: + name: Flux Operator Release v${{ env.tag }} + tag_name: ${{ env.tag }} + body_path: CHANGELOG.md + body: "flux operator release ${{ env.tag }}" + files: | + examples/dist/flux-operator-arm.yaml + examples/dist/flux-operator.yaml + env: + GITHUB_REPOSITORY: flux-framework/flux-operator \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 152e6690..2741cce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/flux-framework/flux-operator/tree/main) (0.0.x) + - First release supporting experimenting bursting / scaling and customization (0.1.0) - Support for automated testing of examples/tests (0.0.x) - Early support for a basic multi-user mode. - Addition of local volumes for workflows that share data. diff --git a/Makefile b/Makefile index 9bfe358c..daa3627d 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,6 @@ api: generate api rm -rf ./sdk/python/${API_VERSION}/fluxoperator/model/* rm -rf ./sdk/python/${API_VERSION}/fluxoperator/test/test_*.py java -jar ${SWAGGER_JAR} generate -i ${SWAGGER_API_JSON} -g python-legacy -o ./sdk/python/${API_VERSION} -c ./hack/python-sdk/swagger_config.json --git-repo-id flux-operator --git-user-id flux-framework - cp ./hack/python-sdk/template/* ./sdk/python/${API_VERSION}/ # These were needed for the python (not python-legacy) # cp ./hack/python-sdk/fluxoperator/* ./sdk/python/${API_VERSION}/fluxoperator/model/ diff --git a/api/v1alpha1/minicluster_types.go b/api/v1alpha1/minicluster_types.go index b7d7f7b8..09ac80c9 100644 --- a/api/v1alpha1/minicluster_types.go +++ b/api/v1alpha1/minicluster_types.go @@ -385,6 +385,10 @@ type FluxSpec struct { //+optional CurveCertSecret string `json:"curveCertSecret"` + // Custom attributes for the fluxion scheduler + //+optional + Scheduler FluxScheduler `json:"scheduler"` + // Expect a secret (named according to this string) // for a munge key. This is intended for bursting. // Assumed to be at /etc/munge/munge.key @@ -404,6 +408,14 @@ type FluxSpec struct { BrokerConfig string `json:"brokerConfig"` } +// FluxScheduler attributes +type FluxScheduler struct { + + // Scheduler queue policy, defaults to "fcfs" can also be "easy" + // +optional + QueuePolicy string `json:"queuePolicy"` +} + // Bursting Config // For simplicity, we internally handle the name of the job (hostnames) type Bursting struct { diff --git a/api/v1alpha1/swagger.json b/api/v1alpha1/swagger.json index aa94c1c7..fa79a78f 100644 --- a/api/v1alpha1/swagger.json +++ b/api/v1alpha1/swagger.json @@ -187,6 +187,17 @@ } } }, + "FluxScheduler": { + "description": "FluxScheduler attributes", + "type": "object", + "properties": { + "queuePolicy": { + "description": "Scheduler queue policy, defaults to \"fcfs\" can also be \"easy\"", + "type": "string", + "default": "" + } + } + }, "FluxSpec": { "type": "object", "properties": { @@ -241,6 +252,11 @@ "type": "string", "default": "" }, + "scheduler": { + "description": "Custom attributes for the fluxion scheduler", + "default": {}, + "$ref": "#/definitions/FluxScheduler" + }, "wrap": { "description": "Commands for flux start --wrap", "type": "string" diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index f4da6827..c7dd093c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -166,9 +166,25 @@ func (in *FluxRestful) DeepCopy() *FluxRestful { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FluxScheduler) DeepCopyInto(out *FluxScheduler) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FluxScheduler. +func (in *FluxScheduler) DeepCopy() *FluxScheduler { + if in == nil { + return nil + } + out := new(FluxScheduler) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FluxSpec) DeepCopyInto(out *FluxSpec) { *out = *in + out.Scheduler = in.Scheduler in.Bursting.DeepCopyInto(&out.Bursting) } diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 4edeb516..53d34d2c 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -31,6 +31,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "./api/v1alpha1/.ContainerVolume": schema__api_v1alpha1__ContainerVolume(ref), "./api/v1alpha1/.FluxBroker": schema__api_v1alpha1__FluxBroker(ref), "./api/v1alpha1/.FluxRestful": schema__api_v1alpha1__FluxRestful(ref), + "./api/v1alpha1/.FluxScheduler": schema__api_v1alpha1__FluxScheduler(ref), "./api/v1alpha1/.FluxSpec": schema__api_v1alpha1__FluxSpec(ref), "./api/v1alpha1/.FluxUser": schema__api_v1alpha1__FluxUser(ref), "./api/v1alpha1/.LifeCycle": schema__api_v1alpha1__LifeCycle(ref), @@ -359,6 +360,27 @@ func schema__api_v1alpha1__FluxRestful(ref common.ReferenceCallback) common.Open } } +func schema__api_v1alpha1__FluxScheduler(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FluxScheduler attributes", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "queuePolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Scheduler queue policy, defaults to \"fcfs\" can also be \"easy\"", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema__api_v1alpha1__FluxSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -428,6 +450,13 @@ func schema__api_v1alpha1__FluxSpec(ref common.ReferenceCallback) common.OpenAPI Format: "", }, }, + "scheduler": { + SchemaProps: spec.SchemaProps{ + Description: "Custom attributes for the fluxion scheduler", + Default: map[string]interface{}{}, + Ref: ref("./api/v1alpha1/.FluxScheduler"), + }, + }, "mungeSecret": { SchemaProps: spec.SchemaProps{ Description: "Expect a secret (named according to this string) for a munge key. This is intended for bursting. Assumed to be at /etc/munge/munge.key This is binary data.", @@ -455,7 +484,7 @@ func schema__api_v1alpha1__FluxSpec(ref common.ReferenceCallback) common.OpenAPI }, }, Dependencies: []string{ - "./api/v1alpha1/.Bursting"}, + "./api/v1alpha1/.Bursting", "./api/v1alpha1/.FluxScheduler"}, } } diff --git a/chart/templates/minicluster-crd.yaml b/chart/templates/minicluster-crd.yaml index 052ee7fb..71dcaa51 100644 --- a/chart/templates/minicluster-crd.yaml +++ b/chart/templates/minicluster-crd.yaml @@ -371,6 +371,14 @@ spec: be set in the user interface to override here. This is only valid for a FluxRunner "runFlux" true type: string + scheduler: + description: Custom attributes for the fluxion scheduler + properties: + queuePolicy: + description: Scheduler queue policy, defaults to "fcfs" can + also be "easy" + type: string + type: object wrap: description: Commands for flux start --wrap type: string diff --git a/config/crd/bases/flux-framework.org_miniclusters.yaml b/config/crd/bases/flux-framework.org_miniclusters.yaml index 4afcc7f2..7536e451 100644 --- a/config/crd/bases/flux-framework.org_miniclusters.yaml +++ b/config/crd/bases/flux-framework.org_miniclusters.yaml @@ -374,6 +374,14 @@ spec: be set in the user interface to override here. This is only valid for a FluxRunner "runFlux" true type: string + scheduler: + description: Custom attributes for the fluxion scheduler + properties: + queuePolicy: + description: Scheduler queue policy, defaults to "fcfs" can + also be "easy" + type: string + type: object wrap: description: Commands for flux start --wrap type: string diff --git a/controllers/flux/templates/broker.toml b/controllers/flux/templates/broker.toml index 53e957c0..9fec5699 100644 --- a/controllers/flux/templates/broker.toml +++ b/controllers/flux/templates/broker.toml @@ -24,4 +24,10 @@ hosts = [{host="{{ .Spec.Flux.Bursting.LeadBroker.Address }}", bind="tcp://eth0: [archive] dbpath = "/var/lib/flux/job-archive.sqlite" period = "1m" -busytimeout = "50s" \ No newline at end of file +busytimeout = "50s" + +# Configure the flux-sched (fluxion) scheduler policies +# The 'lonodex' match policy selects node-exclusive scheduling, and can be +# commented out if jobs may share nodes. +[sched-fluxion-qmanager] +queue-policy = "{{ if .Spec.Flux.Scheduler.QueuePolicy }}{{ .Spec.Flux.Scheduler.QueuePolicy }}{{ else }}fcfs{{ end }}" \ No newline at end of file diff --git a/docs/getting_started/custom-resource-definition.md b/docs/getting_started/custom-resource-definition.md index c043d350..09d5588b 100644 --- a/docs/getting_started/custom-resource-definition.md +++ b/docs/getting_started/custom-resource-definition.md @@ -358,6 +358,34 @@ flux: In the above, we would add `--wrap=strace,-e,network,-tt` to flux start commands. +#### scheduler + +Under flux->scheduler you can define attributes for the scheduler. We currently allow +setting a custom queue policy. The default (if unset) looks like this for first come first serve: + +```yaml +flux: + scheduler: + queuePolicy: fcfs +``` + +To change to a policy that supports backfilling, you can change this to "easy": + +```yaml +flux: + scheduler: + queuePolicy: easy +``` + +And the broker.toml config will update appropriately: + +```toml +[sched-fluxion-qmanager] +queue-policy = "easy" +``` + +You can learn more about queues [here](https://flux-framework.readthedocs.io/en/latest/guides/admin-guide.html?h=system#adding-queues). Please [open an issue](https://github.com/flux-framework/flux-operator/issues) if you want support for something that you don't see. Also note that you can set an entire [broker config](#broker-config) for more detailed customization. + #### minimalService By default, the Flux MiniCluster will be created with a headless service across the cluster, diff --git a/examples/dist/flux-operator-arm.yaml b/examples/dist/flux-operator-arm.yaml index f119b610..5cd3acf5 100644 --- a/examples/dist/flux-operator-arm.yaml +++ b/examples/dist/flux-operator-arm.yaml @@ -380,6 +380,14 @@ spec: be set in the user interface to override here. This is only valid for a FluxRunner "runFlux" true type: string + scheduler: + description: Custom attributes for the fluxion scheduler + properties: + queuePolicy: + description: Scheduler queue policy, defaults to "fcfs" can + also be "easy" + type: string + type: object wrap: description: Commands for flux start --wrap type: string diff --git a/examples/dist/flux-operator.yaml b/examples/dist/flux-operator.yaml index 1abb1573..d1784e60 100644 --- a/examples/dist/flux-operator.yaml +++ b/examples/dist/flux-operator.yaml @@ -380,6 +380,14 @@ spec: be set in the user interface to override here. This is only valid for a FluxRunner "runFlux" true type: string + scheduler: + description: Custom attributes for the fluxion scheduler + properties: + queuePolicy: + description: Scheduler queue policy, defaults to "fcfs" can + also be "easy" + type: string + type: object wrap: description: Commands for flux start --wrap type: string diff --git a/hack/python-sdk/template/README.md b/hack/python-sdk/template/README.md deleted file mode 100644 index 565200d1..00000000 --- a/hack/python-sdk/template/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# flux-framework fluxoperator - -Python SDK for Flux-Operator - -This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: v1alpha1 -- Build package: org.openapitools.codegen.languages.PythonClientCodegen - -See the [docs](https://github.com/flux-framework/flux-operator/tree/main/sdk/python/v1alpha1/docs) for more details! diff --git a/hack/python-sdk/template/requirements.txt b/hack/python-sdk/template/requirements.txt deleted file mode 100644 index ce53d4a6..00000000 --- a/hack/python-sdk/template/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -future; python_version<="2.7" -six >= 1.10 -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3 -requests -kubernetes \ No newline at end of file diff --git a/hack/python-sdk/template/setup.py b/hack/python-sdk/template/setup.py deleted file mode 100644 index 8bc7c90c..00000000 --- a/hack/python-sdk/template/setup.py +++ /dev/null @@ -1,60 +0,0 @@ -""" - fluxoperator - - Python SDK for Flux-Operator # noqa: E501 - - The version of the OpenAPI document: v1alpha1 - Generated by: https://openapi-generator.tech -""" - -import os - -from setuptools import find_packages, setup # noqa: H301 - -# Make sure everything is relative to setup.py -install_path = os.path.dirname(os.path.abspath(__file__)) -os.chdir(install_path) - -DESCRIPTION = "Python SDK for the Flux Operator" -# Try to read description, otherwise fallback to short description -try: - with open(os.path.join("docs", "README.md")) as filey: - LONG_DESCRIPTION = filey.read() -except Exception: - LONG_DESCRIPTION = DESCRIPTION - -################################################################################ -# MAIN ######################################################################### -################################################################################ - -if __name__ == "__main__": - setup( - name="fluxoperator", - version="0.0.31", - author="Vanessasaurus", - author_email="vsoch@users.noreply.github.com", - maintainer="Vanessasaurus", - packages=find_packages(), - include_package_data=True, - zip_safe=False, - url="https://github.com/flux-framework/flux-operator/tree/main/python-sdk/v1alpha1", - license="Apache 2.0", - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - keywords="flux-operator,flux-framework,kubernetes,workflows,jobs-api", - setup_requires=["pytest-runner"], - install_requires=["kubernetes", "requests"], - tests_require=["pytest", "pytest-cov"], - classifiers=[ - "Intended Audience :: Science/Research", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: C", - "Programming Language :: Python", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Unix", - "Programming Language :: Python :: 3.7", - ], - ) diff --git a/sdk/python/v1alpha1/.openapi-generator-ignore b/sdk/python/v1alpha1/.openapi-generator-ignore index 7484ee59..8ad49a5c 100644 --- a/sdk/python/v1alpha1/.openapi-generator-ignore +++ b/sdk/python/v1alpha1/.openapi-generator-ignore @@ -4,20 +4,6 @@ # Use this file to prevent files from being overwritten by the generator. # The patterns follow closely to .gitignore or .dockerignore. -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md +setup.py +README.md +requirements.txt \ No newline at end of file diff --git a/sdk/python/v1alpha1/.openapi-generator/FILES b/sdk/python/v1alpha1/.openapi-generator/FILES index 770b549d..26d56e7d 100644 --- a/sdk/python/v1alpha1/.openapi-generator/FILES +++ b/sdk/python/v1alpha1/.openapi-generator/FILES @@ -1,7 +1,6 @@ .gitignore .gitlab-ci.yml .travis.yml -README.md docs/BurstedCluster.md docs/Bursting.md docs/Commands.md @@ -9,6 +8,7 @@ docs/ContainerResources.md docs/ContainerVolume.md docs/FluxBroker.md docs/FluxRestful.md +docs/FluxScheduler.md docs/FluxSpec.md docs/FluxUser.md docs/LifeCycle.md @@ -39,6 +39,7 @@ fluxoperator/models/container_resources.py fluxoperator/models/container_volume.py fluxoperator/models/flux_broker.py fluxoperator/models/flux_restful.py +fluxoperator/models/flux_scheduler.py fluxoperator/models/flux_spec.py fluxoperator/models/flux_user.py fluxoperator/models/life_cycle.py @@ -58,18 +59,7 @@ fluxoperator/models/secret.py fluxoperator/models/security_context.py fluxoperator/rest.py git_push.sh -requirements.txt setup.cfg -setup.py test-requirements.txt test/__init__.py -test/test_mini_cluster.py -test/test_mini_cluster_archive.py -test/test_mini_cluster_container.py -test/test_mini_cluster_existing_volume.py -test/test_mini_cluster_list.py -test/test_mini_cluster_spec.py -test/test_mini_cluster_status.py -test/test_mini_cluster_user.py -test/test_mini_cluster_volume.py tox.ini diff --git a/sdk/python/v1alpha1/CHANGELOG.md b/sdk/python/v1alpha1/CHANGELOG.md index bae42f61..3b89d8e1 100644 --- a/sdk/python/v1alpha1/CHANGELOG.md +++ b/sdk/python/v1alpha1/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/flux-framework/flux-operator/tree/main/sdk/python/v2alpha1) (0.0.x) + - first release alongside flux operator (0.1.0) - support for bursting and curve cert as a secret (0.0.31) - support for simple bursting (0.0.3) - COMPLETED is an acceptable state for wait_pods (0.0.29) diff --git a/sdk/python/v1alpha1/docs/FluxScheduler.md b/sdk/python/v1alpha1/docs/FluxScheduler.md new file mode 100644 index 00000000..80618477 --- /dev/null +++ b/sdk/python/v1alpha1/docs/FluxScheduler.md @@ -0,0 +1,12 @@ +# FluxScheduler + +FluxScheduler attributes + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**queue_policy** | **str** | Scheduler queue policy, defaults to \"fcfs\" can also be \"easy\" | [optional] [default to ''] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/sdk/python/v1alpha1/docs/FluxSpec.md b/sdk/python/v1alpha1/docs/FluxSpec.md index 50c21fb7..13e2f725 100644 --- a/sdk/python/v1alpha1/docs/FluxSpec.md +++ b/sdk/python/v1alpha1/docs/FluxSpec.md @@ -14,6 +14,7 @@ Name | Type | Description | Notes **minimal_service** | **bool** | Only expose the broker service (to reduce load on DNS) | [optional] [default to False] **munge_secret** | **str** | Expect a secret (named according to this string) for a munge key. This is intended for bursting. Assumed to be at /etc/munge/munge.key This is binary data. | [optional] [default to ''] **option_flags** | **str** | Flux option flags, usually provided with -o optional - if needed, default option flags for the server These can also be set in the user interface to override here. This is only valid for a FluxRunner \"runFlux\" true | [optional] [default to ''] +**scheduler** | [**FluxScheduler**](FluxScheduler.md) | | [optional] **wrap** | **str** | Commands for flux start --wrap | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdk/python/v1alpha1/docs/README.md b/sdk/python/v1alpha1/docs/README.md index 9b3a05e0..9db94463 100644 --- a/sdk/python/v1alpha1/docs/README.md +++ b/sdk/python/v1alpha1/docs/README.md @@ -61,8 +61,9 @@ from pprint import pprint - [Commands](Commands.md) - [ContainerResources](dContainerResources.md) - [ContainerVolume](ContainerVolume.md) - - [FluxBroker](FluxBrokerl.md) + - [FluxBroker](FluxBroker.md) - [FluxRestful](FluxRestful.md) + - [FluxScheduler](FluxScheduler.md) - [FluxSpec](FluxSpec.md) - [FluxUser](FluxUser.md) - [LifeCycle](LifeCycle.md) diff --git a/sdk/python/v1alpha1/fluxoperator/__init__.py b/sdk/python/v1alpha1/fluxoperator/__init__.py index 708fa74a..a3d3d404 100644 --- a/sdk/python/v1alpha1/fluxoperator/__init__.py +++ b/sdk/python/v1alpha1/fluxoperator/__init__.py @@ -35,6 +35,7 @@ from fluxoperator.models.container_volume import ContainerVolume from fluxoperator.models.flux_broker import FluxBroker from fluxoperator.models.flux_restful import FluxRestful +from fluxoperator.models.flux_scheduler import FluxScheduler from fluxoperator.models.flux_spec import FluxSpec from fluxoperator.models.flux_user import FluxUser from fluxoperator.models.life_cycle import LifeCycle diff --git a/sdk/python/v1alpha1/fluxoperator/models/__init__.py b/sdk/python/v1alpha1/fluxoperator/models/__init__.py index c85a0dcc..d41b0a1e 100644 --- a/sdk/python/v1alpha1/fluxoperator/models/__init__.py +++ b/sdk/python/v1alpha1/fluxoperator/models/__init__.py @@ -21,6 +21,7 @@ from fluxoperator.models.container_volume import ContainerVolume from fluxoperator.models.flux_broker import FluxBroker from fluxoperator.models.flux_restful import FluxRestful +from fluxoperator.models.flux_scheduler import FluxScheduler from fluxoperator.models.flux_spec import FluxSpec from fluxoperator.models.flux_user import FluxUser from fluxoperator.models.life_cycle import LifeCycle diff --git a/sdk/python/v1alpha1/fluxoperator/models/flux_scheduler.py b/sdk/python/v1alpha1/fluxoperator/models/flux_scheduler.py new file mode 100644 index 00000000..06401703 --- /dev/null +++ b/sdk/python/v1alpha1/fluxoperator/models/flux_scheduler.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + fluxoperator + + Python SDK for Flux-Operator # noqa: E501 + + The version of the OpenAPI document: v1alpha1 + Generated by: https://openapi-generator.tech +""" + + +import inspect +import pprint +import re # noqa: F401 +import six + +from fluxoperator.configuration import Configuration + + +class FluxScheduler(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'queue_policy': 'str' + } + + attribute_map = { + 'queue_policy': 'queuePolicy' + } + + def __init__(self, queue_policy='', local_vars_configuration=None): # noqa: E501 + """FluxScheduler - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration.get_default_copy() + self.local_vars_configuration = local_vars_configuration + + self._queue_policy = None + self.discriminator = None + + if queue_policy is not None: + self.queue_policy = queue_policy + + @property + def queue_policy(self): + """Gets the queue_policy of this FluxScheduler. # noqa: E501 + + Scheduler queue policy, defaults to \"fcfs\" can also be \"easy\" # noqa: E501 + + :return: The queue_policy of this FluxScheduler. # noqa: E501 + :rtype: str + """ + return self._queue_policy + + @queue_policy.setter + def queue_policy(self, queue_policy): + """Sets the queue_policy of this FluxScheduler. + + Scheduler queue policy, defaults to \"fcfs\" can also be \"easy\" # noqa: E501 + + :param queue_policy: The queue_policy of this FluxScheduler. # noqa: E501 + :type queue_policy: str + """ + + self._queue_policy = queue_policy + + def to_dict(self, serialize=False): + """Returns the model properties as a dict""" + result = {} + + def convert(x): + if hasattr(x, "to_dict"): + args = inspect.getargspec(x.to_dict).args + if len(args) == 1: + return x.to_dict() + else: + return x.to_dict(serialize) + else: + return x + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + attr = self.attribute_map.get(attr, attr) if serialize else attr + if isinstance(value, list): + result[attr] = list(map( + lambda x: convert(x), + value + )) + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], convert(item[1])), + value.items() + )) + else: + result[attr] = convert(value) + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FluxScheduler): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, FluxScheduler): + return True + + return self.to_dict() != other.to_dict() diff --git a/sdk/python/v1alpha1/fluxoperator/models/flux_spec.py b/sdk/python/v1alpha1/fluxoperator/models/flux_spec.py index 3456ae9b..8f844cbe 100644 --- a/sdk/python/v1alpha1/fluxoperator/models/flux_spec.py +++ b/sdk/python/v1alpha1/fluxoperator/models/flux_spec.py @@ -43,6 +43,7 @@ class FluxSpec(object): 'minimal_service': 'bool', 'munge_secret': 'str', 'option_flags': 'str', + 'scheduler': 'FluxScheduler', 'wrap': 'str' } @@ -57,10 +58,11 @@ class FluxSpec(object): 'minimal_service': 'minimalService', 'munge_secret': 'mungeSecret', 'option_flags': 'optionFlags', + 'scheduler': 'scheduler', 'wrap': 'wrap' } - def __init__(self, broker_config='', bursting=None, connect_timeout='5s', curve_cert='', curve_cert_secret='', install_root='/usr', log_level=6, minimal_service=False, munge_secret='', option_flags='', wrap=None, local_vars_configuration=None): # noqa: E501 + def __init__(self, broker_config='', bursting=None, connect_timeout='5s', curve_cert='', curve_cert_secret='', install_root='/usr', log_level=6, minimal_service=False, munge_secret='', option_flags='', scheduler=None, wrap=None, local_vars_configuration=None): # noqa: E501 """FluxSpec - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() @@ -76,6 +78,7 @@ def __init__(self, broker_config='', bursting=None, connect_timeout='5s', curve_ self._minimal_service = None self._munge_secret = None self._option_flags = None + self._scheduler = None self._wrap = None self.discriminator = None @@ -99,6 +102,8 @@ def __init__(self, broker_config='', bursting=None, connect_timeout='5s', curve_ self.munge_secret = munge_secret if option_flags is not None: self.option_flags = option_flags + if scheduler is not None: + self.scheduler = scheduler if wrap is not None: self.wrap = wrap @@ -330,6 +335,27 @@ def option_flags(self, option_flags): self._option_flags = option_flags + @property + def scheduler(self): + """Gets the scheduler of this FluxSpec. # noqa: E501 + + + :return: The scheduler of this FluxSpec. # noqa: E501 + :rtype: FluxScheduler + """ + return self._scheduler + + @scheduler.setter + def scheduler(self, scheduler): + """Sets the scheduler of this FluxSpec. + + + :param scheduler: The scheduler of this FluxSpec. # noqa: E501 + :type scheduler: FluxScheduler + """ + + self._scheduler = scheduler + @property def wrap(self): """Gets the wrap of this FluxSpec. # noqa: E501 diff --git a/sdk/python/v1alpha1/setup.py b/sdk/python/v1alpha1/setup.py index 8bc7c90c..67d74ae5 100644 --- a/sdk/python/v1alpha1/setup.py +++ b/sdk/python/v1alpha1/setup.py @@ -30,7 +30,7 @@ if __name__ == "__main__": setup( name="fluxoperator", - version="0.0.31", + version="0.1.0", author="Vanessasaurus", author_email="vsoch@users.noreply.github.com", maintainer="Vanessasaurus", diff --git a/sdk/python/v1alpha1/test/test_flux_scheduler.py b/sdk/python/v1alpha1/test/test_flux_scheduler.py new file mode 100644 index 00000000..ce5e2cc7 --- /dev/null +++ b/sdk/python/v1alpha1/test/test_flux_scheduler.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + fluxoperator + + Python SDK for Flux-Operator # noqa: E501 + + The version of the OpenAPI document: v1alpha1 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import fluxoperator +from fluxoperator.models.flux_scheduler import FluxScheduler # noqa: E501 +from fluxoperator.rest import ApiException + +class TestFluxScheduler(unittest.TestCase): + """FluxScheduler unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test FluxScheduler + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = fluxoperator.models.flux_scheduler.FluxScheduler() # noqa: E501 + if include_optional : + return FluxScheduler( + queue_policy = '' + ) + else : + return FluxScheduler( + ) + + def testFluxScheduler(self): + """Test FluxScheduler""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()