Skip to content

Commit

Permalink
[SDK/CLI] Remove data portal url from the result of pfazure run show (#…
Browse files Browse the repository at this point in the history
…1497)

# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
0mza987 authored Dec 18, 2023
1 parent 953bf74 commit a5b2ced
Show file tree
Hide file tree
Showing 18 changed files with 5,068 additions and 328 deletions.
3 changes: 0 additions & 3 deletions src/promptflow/promptflow/_sdk/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,8 @@ class ConnectionFields(str, Enum):
class RunDataKeys:
PORTAL_URL = "portal_url"
DATA = "data"
DATA_PORTAL_URL = "data_portal_url"
RUN = "run"
INPUT_RUN_PORTAL_URL = "input_run_portal_url"
OUTPUT = "output"
OUTPUT_PORTAL_URL = "output_portal_url"


class RunHistoryKeys:
Expand Down
10 changes: 0 additions & 10 deletions src/promptflow/promptflow/_sdk/entities/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ def __init__(
self._experiment_name = kwargs.get("experiment_name", None)
elif self._run_source == RunInfoSources.RUN_HISTORY:
self._error = kwargs.get("error", None)
self._data_portal_url = kwargs.get("data_portal_url", None)
self._input_run_portal_url = kwargs.get("input_run_portal_url", None)
self._output = kwargs.get("output", None)
self._output_portal_url = kwargs.get("output_portal_url", None)
elif self._run_source == RunInfoSources.EXISTING_RUN:
# when the run is created from an existing run folder, the output path is also the source path
self._output_path = Path(source)
Expand Down Expand Up @@ -269,7 +266,6 @@ def _from_index_service_entity(cls, run_entity: dict) -> "Run":
start_time=date_parser.parse(start_time) if start_time else None,
end_time=date_parser.parse(end_time) if end_time else None,
duration=duration,
portal_url=run_entity[RunDataKeys.PORTAL_URL],
creation_context=run_entity["properties"]["creationContext"],
experiment_name=run_entity["properties"]["experimentName"],
)
Expand Down Expand Up @@ -300,11 +296,8 @@ def _from_run_history_entity(cls, run_entity: dict) -> "Run":
portal_url=run_entity[RunDataKeys.PORTAL_URL],
creation_context=run_entity["createdBy"],
data=run_entity[RunDataKeys.DATA],
data_portal_url=run_entity[RunDataKeys.DATA_PORTAL_URL],
run=run_entity[RunDataKeys.RUN],
input_run_portal_url=run_entity[RunDataKeys.INPUT_RUN_PORTAL_URL],
output=run_entity[RunDataKeys.OUTPUT],
output_portal_url=run_entity[RunDataKeys.OUTPUT_PORTAL_URL],
)

@classmethod
Expand Down Expand Up @@ -391,12 +384,9 @@ def _to_dict(self, *, exclude_additional_info: bool = False, exclude_debug_info:
result["duration"] = self._duration
result[RunDataKeys.PORTAL_URL] = self._portal_url
result[RunDataKeys.DATA] = self.data
result[RunDataKeys.DATA_PORTAL_URL] = self._data_portal_url
result[RunDataKeys.OUTPUT] = self._output
result[RunDataKeys.OUTPUT_PORTAL_URL] = self._output_portal_url
if self.run:
result[RunDataKeys.RUN] = self.run
result[RunDataKeys.INPUT_RUN_PORTAL_URL] = self._input_run_portal_url
if self._error:
result["error"] = self._error
if exclude_additional_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.8.0, generator: @autorest/python@5.12.2)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import datetime
import functools
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
Expand All @@ -15,7 +16,7 @@

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._flow_runs_admin_operations import build_batch_update_service_logs_request, build_check_policy_validation_async_request, build_get_storage_info_request, build_log_flow_run_event_request, build_log_flow_run_event_v2_request, build_log_result_for_bulk_run_request, build_send_policy_validation_async_request, build_submit_bulk_run_async_request, build_update_service_logs_request
from ...operations._flow_runs_admin_operations import build_batch_update_service_logs_request, build_check_policy_validation_async_request, build_get_storage_info_request, build_log_flow_run_event_request, build_log_flow_run_event_v2_request, build_log_flow_run_terminated_event_request, build_log_result_for_bulk_run_request, build_send_policy_validation_async_request, build_submit_bulk_run_async_request, build_update_service_logs_request
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -49,8 +50,9 @@ async def submit_bulk_run_async(
workspace_name: str,
flow_id: str,
bulk_run_id: str,
error_handling_mode: Optional[Union[str, "_models.ErrorHandlingMode"]] = None,
**kwargs: Any
) -> "_models.FlowRunResult":
) -> "_models.SubmitBulkRunResponse":
"""submit_bulk_run_async.
:param subscription_id: The Azure Subscription ID.
Expand All @@ -63,12 +65,14 @@ async def submit_bulk_run_async(
:type flow_id: str
:param bulk_run_id:
:type bulk_run_id: str
:param error_handling_mode:
:type error_handling_mode: str or ~flow.models.ErrorHandlingMode
:keyword callable cls: A custom type or function that will be passed the direct response
:return: FlowRunResult, or the result of cls(response)
:rtype: ~flow.models.FlowRunResult
:return: SubmitBulkRunResponse, or the result of cls(response)
:rtype: ~flow.models.SubmitBulkRunResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.FlowRunResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.SubmitBulkRunResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand All @@ -81,6 +85,7 @@ async def submit_bulk_run_async(
workspace_name=workspace_name,
flow_id=flow_id,
bulk_run_id=bulk_run_id,
error_handling_mode=error_handling_mode,
template_url=self.submit_bulk_run_async.metadata['url'],
)
request = _convert_request(request)
Expand All @@ -94,7 +99,7 @@ async def submit_bulk_run_async(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('FlowRunResult', pipeline_response)
deserialized = self._deserialize('SubmitBulkRunResponse', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})
Expand Down Expand Up @@ -482,6 +487,73 @@ async def log_flow_run_event_v2(
log_flow_run_event_v2.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/flowRuns/{flowRunId}/logEvent'} # type: ignore


@distributed_trace_async
async def log_flow_run_terminated_event(
self,
subscription_id: str,
resource_group_name: str,
workspace_name: str,
flow_id: str,
flow_run_id: str,
last_checked_time: Optional[datetime.datetime] = None,
**kwargs: Any
) -> "_models.LogRunTerminatedEventDto":
"""log_flow_run_terminated_event.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param flow_id:
:type flow_id: str
:param flow_run_id:
:type flow_run_id: str
:param last_checked_time:
:type last_checked_time: ~datetime.datetime
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LogRunTerminatedEventDto, or the result of cls(response)
:rtype: ~flow.models.LogRunTerminatedEventDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.LogRunTerminatedEventDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))


request = build_log_flow_run_terminated_event_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
flow_id=flow_id,
flow_run_id=flow_run_id,
last_checked_time=last_checked_time,
template_url=self.log_flow_run_terminated_event.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('LogRunTerminatedEventDto', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

log_flow_run_terminated_event.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowRunsAdmin/{flowId}/flowRuns/{flowRunId}/logTerminatedEvent'} # type: ignore


@distributed_trace_async
async def update_service_logs(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
Expand All @@ -15,7 +15,7 @@

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._flow_sessions_operations import build_create_flow_session_request, build_delete_flow_session_request, build_poll_operation_status_request
from ...operations._flow_sessions_operations import build_create_flow_session_request, build_delete_flow_session_request, build_get_flow_session_request, build_get_standby_pools_request, build_poll_operation_status_request
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -115,6 +115,65 @@ async def create_flow_session(
create_flow_session.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/{sessionId}'} # type: ignore


@distributed_trace_async
async def get_flow_session(
self,
subscription_id: str,
resource_group_name: str,
workspace_name: str,
session_id: str,
**kwargs: Any
) -> "_models.GetTrainingSessionDto":
"""get_flow_session.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param session_id:
:type session_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GetTrainingSessionDto, or the result of cls(response)
:rtype: ~flow.models.GetTrainingSessionDto
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.GetTrainingSessionDto"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))


request = build_get_flow_session_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
session_id=session_id,
template_url=self.get_flow_session.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('GetTrainingSessionDto', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

get_flow_session.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/{sessionId}'} # type: ignore


@distributed_trace_async
async def delete_flow_session(
self,
Expand Down Expand Up @@ -256,3 +315,58 @@ async def poll_operation_status(

poll_operation_status.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/{sessionId}/{actionType}/locations/{location}/operations/{operationId}'} # type: ignore


@distributed_trace_async
async def get_standby_pools(
self,
subscription_id: str,
resource_group_name: str,
workspace_name: str,
**kwargs: Any
) -> List["_models.StandbyPoolProperties"]:
"""get_standby_pools.
:param subscription_id: The Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: The Name of the resource group in which the workspace is located.
:type resource_group_name: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: list of StandbyPoolProperties, or the result of cls(response)
:rtype: list[~flow.models.StandbyPoolProperties]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[List["_models.StandbyPoolProperties"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))


request = build_get_standby_pools_request(
subscription_id=subscription_id,
resource_group_name=resource_group_name,
workspace_name=workspace_name,
template_url=self.get_standby_pools.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('[StandbyPoolProperties]', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

get_standby_pools.metadata = {'url': '/flow/api/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/FlowSessions/standbypools'} # type: ignore

Loading

0 comments on commit a5b2ced

Please sign in to comment.