-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Container Apps session execute new api-version #8249
Changes from 17 commits
8fa3228
c12450a
9a5113e
9fa414d
ee37284
988d0ac
511181f
57b148b
5aa7e8f
d15e3ea
d6889ba
33e1f71
cc0d1df
dd6dc3d
cb122e6
be3d72d
6b65c01
71ca21c
18bf7af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ | |
logger = get_logger(__name__) | ||
|
||
PREVIEW_API_VERSION = "2024-10-02-preview" | ||
SESSION_API_VERSION = "2024-02-02-preview" | ||
POLLING_TIMEOUT = 1500 # how many seconds before exiting | ||
POLLING_SECONDS = 2 # how many seconds between requests | ||
POLLING_TIMEOUT_FOR_MANAGED_CERTIFICATE = 1500 # how many seconds before exiting | ||
|
@@ -1157,11 +1156,11 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x): | |
|
||
|
||
class SessionCodeInterpreterPreviewClient(): | ||
api_version = SESSION_API_VERSION | ||
api_version = PREVIEW_API_VERSION | ||
|
||
@classmethod | ||
def execute(cls, cmd, identifier, code_interpreter_envelope, session_pool_endpoint, no_wait=False): | ||
url_fmt = "{}/code/execute?identifier={}&api-version={}" | ||
url_fmt = "{}/executions?identifier={}&api-version={}" | ||
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
identifier, | ||
|
@@ -1180,10 +1179,11 @@ def execute(cls, cmd, identifier, code_interpreter_envelope, session_pool_endpoi | |
return r.json() | ||
|
||
@classmethod | ||
def upload(cls, cmd, identifier, filepath, session_pool_endpoint, no_wait=False): | ||
url_fmt = "{}/files/upload?identifier={}&api-version={}" | ||
def upload(cls, cmd, identifier, filepath, path, session_pool_endpoint, no_wait=False): | ||
url_fmt = "{}/files?{}identifier={}&api-version={}" | ||
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
f"path={path}&" if path is not None else "", | ||
identifier, | ||
cls.api_version) | ||
|
||
|
@@ -1220,11 +1220,13 @@ def upload(cls, cmd, identifier, filepath, session_pool_endpoint, no_wait=False) | |
return r.json() | ||
|
||
@classmethod | ||
def show_file_content(cls, cmd, identifier, filename, session_pool_endpoint): | ||
url_fmt = "{}/files/content/{}?identifier={}&api-version={}" | ||
def show_file_content(cls, cmd, identifier, filename, path, session_pool_endpoint): | ||
path, filename = cls.extract_path_from_filename(path, filename) | ||
url_fmt = "{}/files/{}/content?{}identifier={}&api-version={}" | ||
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
f"path={path}&" if path is not None else "", | ||
identifier, | ||
cls.api_version) | ||
|
||
|
@@ -1235,11 +1237,13 @@ def show_file_content(cls, cmd, identifier, filename, session_pool_endpoint): | |
return json.dumps(r.content.decode()) | ||
|
||
@classmethod | ||
def show_file_metadata(cls, cmd, identifier, filename, session_pool_endpoint): | ||
url_fmt = "{}/files/{}?identifier={}&api-version={}" | ||
def show_file_metadata(cls, cmd, identifier, filename, path, session_pool_endpoint): | ||
path, filename = cls.extract_path_from_filename(path, filename) | ||
url_fmt = "{}/files/{}?{}identifier={}&api-version={}" | ||
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
f"path={path}&" if path is not None else "", | ||
identifier, | ||
cls.api_version) | ||
logger.warning(request_url) | ||
|
@@ -1248,11 +1252,13 @@ def show_file_metadata(cls, cmd, identifier, filename, session_pool_endpoint): | |
return r.json() | ||
|
||
@classmethod | ||
def delete_file(cls, cmd, identifier, filename, session_pool_endpoint, no_wait=False): | ||
url_fmt = "{}/files/{}?identifier={}&api-version={}" | ||
def delete_file(cls, cmd, identifier, filename, path, session_pool_endpoint, no_wait=False): | ||
path, filename = cls.extract_path_from_filename(path, filename) | ||
url_fmt = "{}/files/{}?{}identifier={}&api-version={}" | ||
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
f"path={path}&" if path is not None else "", | ||
identifier, | ||
cls.api_version) | ||
|
||
|
@@ -1280,6 +1286,16 @@ def list_files(cls, cmd, identifier, path, session_pool_endpoint): | |
|
||
r = send_raw_request(cmd.cli_ctx, "GET", request_url, resource=SESSION_RESOURCE) | ||
return r.json() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI style failed remove the whitespece There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, fixed |
||
@staticmethod | ||
def extract_path_from_filename(path, filename): | ||
if '/' not in filename: | ||
return path, filename | ||
path_in_filename, filename = filename.rsplit('/', 1) | ||
if path is None: | ||
return path_in_filename, filename | ||
else: | ||
return path.rstrip("/") + "/" + path_in_filename.lstrip('/'), filename | ||
|
||
|
||
class DotNetComponentPreviewClient(): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,13 +308,10 @@ | |
} | ||
|
||
SessionCodeInterpreterExecution = { | ||
"properties": { | ||
"identifier": None, | ||
"codeInputType": None, | ||
"executionType": None, | ||
"code": None, | ||
"timeoutInSeconds": None | ||
} | ||
"codeInputType": None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with one property There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backend Api is switched to use 2024-10-02-preview in this PR, in which the identifier property is removed in the payload, but still exists in the query parameter. |
||
"executionType": None, | ||
"code": None, | ||
"timeoutInSeconds": None | ||
} | ||
|
||
DaprComponentResiliency = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -438,7 +438,7 @@ def load_arguments(self, _): | |
with self.argument_context('containerapp session code-interpreter', arg_group='file') as c: | ||
c.argument('filename', help="The file to delete or show from the session") | ||
c.argument('filepath', help="The local path to the file to upload to the session") | ||
c.argument('path', help="The path to list files from the session") | ||
c.argument('path', help="The path of files in the session") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recommend to add an example for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
with self.argument_context('containerapp session code-interpreter', arg_group='execute') as c: | ||
c.argument('code', help="The code to execute in the code interpreter session") | ||
|
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.