Skip to content

Commit

Permalink
Add Batch data plane commands (#1875)
Browse files Browse the repository at this point in the history
* Add batch data plane commands:

-- Add custom commands
-- Add auto execution data plane codes
-- Import mgmt commands experience

* Added file stream support

* bug fixes

* Fixed regex raw strings

* Added support for JSON input

* Custom and type validation (#4)

* Additional validation and parsing

* Some cleanups

* Minor code refinements

* Fix pylint errors and get rid unused codes.

* List and type validation (#5)

* list and type validation

* Remove auth kwargs

* Fixed typo

* clean pylint error and add data plane command test.

* Bug fixes (#6)

* Remove auth kwargs

* Bug fixes

* Fixed kwargs

* Move the update pool command to custom command.

* Add custom commands test cases

* Tests and delete confirmation (#7)

* Added some tests

* Bug fixes

* Added tests to sln

* Delete confirmation

* Some pylint cleanup

* More tests and fixes (#8)

* Fix pylint and test errors.

* Following PEP8 complaint.

* Use this decroator on doc transfer

* Deferred imports for performance (#9)

* streamlined imports

* pylint fixes

* Renamed AzureDataPlaneCommand

* PyLint and PEP8 clean up.

* Use single parameter for storage account id and name.

* Review feedback + help fixes (#10)

* node-user -> node user

* Review feedback

* More feedback fixes

* pep fixes

* fixed underscore

* More touch ups

* Review fixes (#11)

* Command refinements

* More command feedback

* Test fixes

* More tests

* Add enum list for vmsize and thumbprint algorithm.

* Streamlined commands (#13)

* streamlined commands

* Updated tests

* Fixed arg loading test

* Further command refinements (#14)

* support silent args

* Fixed pool error message

* Further command editing

* last fixes

* Fixed tests (#15)

* Change the coding style.
  • Loading branch information
xingwu1 authored and derekbekoe committed Feb 7, 2017
1 parent 9815134 commit ba47219
Show file tree
Hide file tree
Showing 34 changed files with 5,793 additions and 460 deletions.
5 changes: 5 additions & 0 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@
<Compile Include="command_modules\azure-cli-appservice\azure\cli\__init__.py" />
<Compile Include="command_modules\azure-cli-appservice\azure\__init__.py" />
<Compile Include="command_modules\azure-cli-appservice\setup.py" />
<Compile Include="command_modules\azure-cli-batch\azure\cli\command_modules\batch\tests\test_batch_commands.py" />
<Compile Include="command_modules\azure-cli-batch\azure\cli\command_modules\batch\tests\test_batch_data_plane_commands.py" />
<Compile Include="command_modules\azure-cli-batch\azure\cli\command_modules\batch\tests\test_batch_data_plane_command_base.py" />
<Compile Include="command_modules\azure-cli-batch\azure\cli\command_modules\batch\tests\test_batch_pool_commands.py" />
<Compile Include="command_modules\azure-cli-batch\azure\cli\command_modules\batch\_command_type.py" />
<Compile Include="command_modules\azure-cli-cloud\azure\cli\command_modules\cloud\commands.py" />
<Compile Include="command_modules\azure-cli-cloud\azure\cli\command_modules\cloud\custom.py" />
<Compile Include="command_modules\azure-cli-cloud\azure\cli\command_modules\cloud\_help.py" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import azure.cli.command_modules.batch._help # pylint: disable=unused-import
import azure.cli.command_modules.batch._help # pylint: disable=unused-import


def load_params(_):
import azure.cli.command_modules.batch._params #pylint: disable=redefined-outer-name
import azure.cli.command_modules.batch._params # pylint: disable=redefined-outer-name


def load_commands():
import azure.cli.command_modules.batch.commands #pylint: disable=redefined-outer-name
import azure.cli.command_modules.batch.commands # pylint: disable=redefined-outer-name
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,73 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.mgmt.batch import BatchManagementClient

from azure.cli.core.commands.client_factory import get_mgmt_service_client
def account_mgmt_client_factory(kwargs):
return batch_client_factory(**kwargs).batch_account


def application_mgmt_client_factory(kwargs):
return batch_client_factory(**kwargs).application


def application_package_client_factory(kwargs):
return batch_client_factory(**kwargs).application_package


def location_client_factory(kwargs):
return batch_client_factory(**kwargs).location


def application_client_factory(kwargs):
return batch_data_service_factory(kwargs).application


def account_client_factory(kwargs):
return batch_data_service_factory(kwargs).account


def certificate_client_factory(kwargs):
return batch_data_service_factory(kwargs).certificate


def pool_client_factory(kwargs):
return batch_data_service_factory(kwargs).pool


def job_client_factory(kwargs):
return batch_data_service_factory(kwargs).job


def job_schedule_client_factory(kwargs):
return batch_data_service_factory(kwargs).job_schedule


def task_client_factory(kwargs):
return batch_data_service_factory(kwargs).task


def file_client_factory(kwargs):
return batch_data_service_factory(kwargs).file


def compute_node_client_factory(kwargs):
return batch_data_service_factory(kwargs).compute_node


def batch_client_factory(**_):
from azure.mgmt.batch import BatchManagementClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client

return get_mgmt_service_client(BatchManagementClient)


def batch_data_service_factory(kwargs):
import azure.batch.batch_service_client as batch
import azure.batch.batch_auth as batchauth

account_name = kwargs.pop('account_name', None)
account_key = kwargs.pop('account_key', None)
account_endpoint = kwargs.pop('account_endpoint', None)
kwargs.pop('force', None)
credentials = batchauth.SharedKeyCredentials(account_name, account_key)
return batch.BatchServiceClient(credentials, base_url=account_endpoint)
Loading

0 comments on commit ba47219

Please sign in to comment.