Skip to content

Commit

Permalink
[Requirements] Bump fastapi and uvicorn (#2629)
Browse files Browse the repository at this point in the history
  • Loading branch information
alonmr committed Jan 1, 2023
1 parent a170e73 commit 89287d7
Show file tree
Hide file tree
Showing 25 changed files with 84 additions and 88 deletions.
2 changes: 1 addition & 1 deletion dockerfiles/mlrun-api/requirements.txt
@@ -1,4 +1,4 @@
uvicorn~=0.17.0
uvicorn~=0.20.0
dask-kubernetes~=0.11.0
apscheduler~=3.6
sqlite3-to-mysql~=1.4
Expand Down
1 change: 0 additions & 1 deletion mlrun/api/main.py
Expand Up @@ -366,7 +366,6 @@ def main():
"mlrun.api.main:app",
host="0.0.0.0",
port=config.httpdb.port,
debug=config.httpdb.debug,
access_log=False,
timeout_keep_alive=config.httpdb.http_connection_timeout_keep_alive,
)
Expand Down
7 changes: 4 additions & 3 deletions mlrun/api/schemas/artifact.py
Expand Up @@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic

import mlrun.api.utils.helpers

class ArtifactCategories(str, enum.Enum):

class ArtifactCategories(mlrun.api.utils.helpers.StrEnum):
model = "model"
dataset = "dataset"
other = "other"
Expand Down Expand Up @@ -55,6 +56,6 @@ class ArtifactIdentifier(pydantic.BaseModel):
# hash: typing.Optional[str]


class ArtifactsFormat(str, enum.Enum):
class ArtifactsFormat(mlrun.api.utils.helpers.StrEnum):
full = "full"
legacy = "legacy"
9 changes: 5 additions & 4 deletions mlrun/api/schemas/auth.py
Expand Up @@ -12,22 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic
from nuclio.auth import AuthInfo as NuclioAuthInfo
from nuclio.auth import AuthKinds as NuclioAuthKinds

import mlrun.api.utils.helpers

class ProjectsRole(str, enum.Enum):

class ProjectsRole(mlrun.api.utils.helpers.StrEnum):
iguazio = "iguazio"
mlrun = "mlrun"
nuclio = "nuclio"
nop = "nop"


class AuthorizationAction(str, enum.Enum):
class AuthorizationAction(mlrun.api.utils.helpers.StrEnum):
read = "read"
create = "create"
update = "update"
Expand All @@ -38,7 +39,7 @@ class AuthorizationAction(str, enum.Enum):
store = "store"


class AuthorizationResourceTypes(str, enum.Enum):
class AuthorizationResourceTypes(mlrun.api.utils.helpers.StrEnum):
project = "project"
log = "log"
runtime_resource = "runtime-resource"
Expand Down
5 changes: 3 additions & 2 deletions mlrun/api/schemas/background_task.py
Expand Up @@ -13,15 +13,16 @@
# limitations under the License.
#
import datetime
import enum
import typing

import pydantic

import mlrun.api.utils.helpers

from .object import ObjectKind


class BackgroundTaskState(str, enum.Enum):
class BackgroundTaskState(mlrun.api.utils.helpers.StrEnum):
succeeded = "succeeded"
failed = "failed"
running = "running"
Expand Down
5 changes: 3 additions & 2 deletions mlrun/api/schemas/clusterization_spec.py
Expand Up @@ -12,17 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic

import mlrun.api.utils.helpers


class ClusterizationSpec(pydantic.BaseModel):
chief_api_state: typing.Optional[str]
chief_version: typing.Optional[str]


class WaitForChiefToReachOnlineStateFeatureFlag(str, enum.Enum):
class WaitForChiefToReachOnlineStateFeatureFlag(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"
15 changes: 7 additions & 8 deletions mlrun/api/schemas/constants.py
Expand Up @@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from enum import Enum

import mergedeep

import mlrun.api.utils.helpers
import mlrun.errors


class PatchMode(str, Enum):
class PatchMode(mlrun.api.utils.helpers.StrEnum):
replace = "replace"
additive = "additive"

Expand All @@ -34,7 +33,7 @@ def to_mergedeep_strategy(self) -> mergedeep.Strategy:
)


class DeletionStrategy(str, Enum):
class DeletionStrategy(mlrun.api.utils.helpers.StrEnum):
restrict = "restrict"
restricted = "restricted"
cascade = "cascade"
Expand Down Expand Up @@ -94,7 +93,7 @@ class HeaderNames:
client_version = f"{headers_prefix}client-version"


class FeatureStorePartitionByField(str, Enum):
class FeatureStorePartitionByField(mlrun.api.utils.helpers.StrEnum):
name = "name" # Supported for feature-store objects

def to_partition_by_db_field(self, db_cls):
Expand All @@ -106,7 +105,7 @@ def to_partition_by_db_field(self, db_cls):
)


class RunPartitionByField(str, Enum):
class RunPartitionByField(mlrun.api.utils.helpers.StrEnum):
name = "name" # Supported for runs objects

def to_partition_by_db_field(self, db_cls):
Expand All @@ -118,7 +117,7 @@ def to_partition_by_db_field(self, db_cls):
)


class SortField(str, Enum):
class SortField(mlrun.api.utils.helpers.StrEnum):
created = "created"
updated = "updated"

Expand All @@ -136,7 +135,7 @@ def to_db_field(self, db_cls):
)


class OrderType(str, Enum):
class OrderType(mlrun.api.utils.helpers.StrEnum):
asc = "asc"
desc = "desc"

Expand Down
11 changes: 6 additions & 5 deletions mlrun/api/schemas/frontend_spec.py
Expand Up @@ -12,32 +12,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic

import mlrun.api.utils.helpers

from .k8s import Resources


class ProjectMembershipFeatureFlag(str, enum.Enum):
class ProjectMembershipFeatureFlag(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"


class PreemptionNodesFeatureFlag(str, enum.Enum):
class PreemptionNodesFeatureFlag(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"


class AuthenticationFeatureFlag(str, enum.Enum):
class AuthenticationFeatureFlag(mlrun.api.utils.helpers.StrEnum):
none = "none"
basic = "basic"
bearer = "bearer"
iguazio = "iguazio"


class NuclioStreamsFeatureFlag(str, enum.Enum):
class NuclioStreamsFeatureFlag(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"

Expand Down
11 changes: 6 additions & 5 deletions mlrun/api/schemas/function.py
Expand Up @@ -13,13 +13,14 @@
# limitations under the License.
#
import typing
from enum import Enum

import pydantic

import mlrun.api.utils.helpers

# Ideally we would want this to be class FunctionState(str, enum.Enum) which is the "FastAPI-compatible" way of creating
# schemas

# Ideally we would want this to be class FunctionState(mlrun.api.utils.helpers.StrEnum) which is the
# "FastAPI-compatible" way of creating schemas
# But, when we save a function to the DB, we pickle the body, which saves the state as an instance of this class (and
# not just a string), then if for some reason we downgrade to 0.6.4, before we had this class, we fail reading (pickle
# load) the function from the DB.
Expand All @@ -45,7 +46,7 @@ class FunctionState:
build = "build"


class PreemptionModes(str, Enum):
class PreemptionModes(mlrun.api.utils.helpers.StrEnum):
# makes function pods be able to run on preemptible nodes
allow = "allow"
# makes the function pods run on preemptible nodes only
Expand All @@ -58,7 +59,7 @@ class PreemptionModes(str, Enum):

# used when running in Iguazio (otherwise use disabled mode)
# populates mlrun.mlconf.function.spec.security_context.enrichment_mode
class SecurityContextEnrichmentModes(str, Enum):
class SecurityContextEnrichmentModes(mlrun.api.utils.helpers.StrEnum):
# always use the user id of the user that triggered the 1st run / created the function
# NOTE: this mode is incomplete and not fully supported yet
retain = "retain"
Expand Down
4 changes: 2 additions & 2 deletions mlrun/api/schemas/http.py
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import mlrun.api.utils.helpers


class HTTPSessionRetryMode(str, enum.Enum):
class HTTPSessionRetryMode(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"
5 changes: 3 additions & 2 deletions mlrun/api/schemas/k8s.py
Expand Up @@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic

import mlrun.api.utils.helpers


class ResourceSpec(pydantic.BaseModel):
cpu: typing.Optional[str]
Expand All @@ -29,7 +30,7 @@ class Resources(pydantic.BaseModel):
limits: ResourceSpec = ResourceSpec()


class NodeSelectorOperator(str, enum.Enum):
class NodeSelectorOperator(mlrun.api.utils.helpers.StrEnum):
"""
A node selector operator is the set of operators that can be used in a node selector requirement
https://github.com/kubernetes/api/blob/b754a94214be15ffc8d648f9fe6481857f1fc2fe/core/v1/types.go#L2765
Expand Down
4 changes: 2 additions & 2 deletions mlrun/api/schemas/marketplace.py
Expand Up @@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
from datetime import datetime, timezone
from typing import List, Optional

from pydantic import BaseModel, Extra, Field

import mlrun.api.utils.helpers
import mlrun.errors
from mlrun.api.schemas.object import ObjectKind, ObjectSpec, ObjectStatus
from mlrun.config import config
Expand All @@ -37,7 +37,7 @@ class Config:


# Currently only functions are supported. Will add more in the future.
class MarketplaceSourceType(str, enum.Enum):
class MarketplaceSourceType(mlrun.api.utils.helpers.StrEnum):
functions = "functions"


Expand Down
4 changes: 2 additions & 2 deletions mlrun/api/schemas/model_endpoints.py
Expand Up @@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
from typing import Any, Dict, List, Optional, Tuple, Union

from pydantic import BaseModel, Field
from pydantic.main import Extra

import mlrun.api.utils.helpers
from mlrun.api.schemas.object import ObjectKind, ObjectSpec, ObjectStatus
from mlrun.utils.model_monitoring import EndpointType, create_model_endpoint_id

Expand All @@ -36,7 +36,7 @@ class Config:
extra = Extra.allow


class ModelMonitoringMode(str, enum.Enum):
class ModelMonitoringMode(mlrun.api.utils.helpers.StrEnum):
enabled = "enabled"
disabled = "disabled"

Expand Down
5 changes: 3 additions & 2 deletions mlrun/api/schemas/object.py
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.
#
from datetime import datetime
from enum import Enum
from typing import List, Optional

from pydantic import BaseModel, Extra

import mlrun.api.utils.helpers


class ObjectMetadata(BaseModel):
name: str
Expand Down Expand Up @@ -68,7 +69,7 @@ class Config:
orm_mode = True


class ObjectKind(str, Enum):
class ObjectKind(mlrun.api.utils.helpers.StrEnum):
project = "project"
feature_set = "FeatureSet"
background_task = "BackgroundTask"
Expand Down
5 changes: 3 additions & 2 deletions mlrun/api/schemas/pipeline.py
Expand Up @@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import enum
import typing

import pydantic

import mlrun.api.utils.helpers

class PipelinesFormat(str, enum.Enum):

class PipelinesFormat(mlrun.api.utils.helpers.StrEnum):
full = "full"
metadata_only = "metadata_only"
summary = "summary"
Expand Down

0 comments on commit 89287d7

Please sign in to comment.