azureml-registry-tools 0.1.0a7__py3-none-any.whl → 0.1.0a9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,7 +102,7 @@ if __name__ == "__main__":
102
102
  parser = argparse.ArgumentParser()
103
103
  parser.add_argument("-i", "--input-dirs", required=True,
104
104
  help="Comma-separated list of directories containing assets")
105
- parser.add_argument("-m", "--schema-file", required=True, type=Path, help="Model Schema file")
105
+ parser.add_argument("-m", "--schema-file", default=Path(__file__).parent / "model.schema.json", type=Path, help="Model Schema file")
106
106
  parser.add_argument("-a", "--asset-config-filename", default=assets.DEFAULT_ASSET_FILENAME,
107
107
  help="Asset config file name to search for")
108
108
  args = parser.parse_args()
@@ -69,7 +69,7 @@ if __name__ == "__main__":
69
69
  # Handle command-line args
70
70
  parser = argparse.ArgumentParser()
71
71
  parser.add_argument("-i", "--input-dirs", required=True, help="Comma-separated list of directories containing assets")
72
- parser.add_argument("-m", "--model-variant-schema-file", required=True, type=Path, help="Model Variant Schema file")
72
+ parser.add_argument("-m", "--model-variant-schema-file", default=Path(__file__).parent / "model-variant.schema.json", type=Path, help="Model Variant Schema file")
73
73
  parser.add_argument("-a", "--asset-config-filename", default=assets.DEFAULT_ASSET_FILENAME, help="Asset config file name to search for")
74
74
  args = parser.parse_args()
75
75
 
@@ -107,12 +107,13 @@ def set_storage_and_sas(asset: AssetConfig, storage_config: dict):
107
107
  _ = extra_config.path.get_uri(token_expiration=timedelta(hours=1))
108
108
 
109
109
 
110
- def build_mutable_asset(base_asset: AssetConfig, mutable_asset_dir: str) -> AssetConfig:
110
+ def build_mutable_asset(base_asset: AssetConfig, mutable_asset_dir: str, storage_overrides_exist: bool = False) -> AssetConfig:
111
111
  """Build a mutable copy of the asset in a temporary directory.
112
112
 
113
113
  Args:
114
114
  base_asset (AssetConfig): Base asset configuration to copy
115
115
  mutable_asset_dir (str): Directory path for the mutable asset copy
116
+ storage_overrides_exist (bool, optional): If True, model config will be modified to set type to custom_model.
116
117
 
117
118
  Returns:
118
119
  AssetConfig: Mutable asset configuration object
@@ -124,12 +125,14 @@ def build_mutable_asset(base_asset: AssetConfig, mutable_asset_dir: str) -> Asse
124
125
  mutable_asset_dir = Path(mutable_asset_dir).resolve()
125
126
  base_asset_file = base_asset.file_name_with_path.resolve()
126
127
  base_spec_file = base_asset.spec_with_path.resolve()
128
+ base_model_file = base_asset.extra_config_with_path.resolve()
127
129
 
128
130
  shutil.copytree(common_dir, mutable_asset_dir, dirs_exist_ok=True)
129
131
 
130
132
  # Reference asset files in mutable directory
131
133
  asset_config_file = mutable_asset_dir / base_asset_file.relative_to(common_dir)
132
134
  spec_config_file = mutable_asset_dir / base_spec_file.relative_to(common_dir)
135
+ model_config_file = mutable_asset_dir / base_model_file.relative_to(common_dir)
133
136
 
134
137
  # Autoincrement version for mutable asset
135
138
  with open(spec_config_file, "r") as f:
@@ -139,6 +142,16 @@ def build_mutable_asset(base_asset: AssetConfig, mutable_asset_dir: str) -> Asse
139
142
  with open(spec_config_file, "w") as f:
140
143
  yaml.dump(spec_config, f)
141
144
 
145
+ # If storage overrides are provided, default set model type to custom_model
146
+ if storage_overrides_exist:
147
+ print("Storage overrides provided, default setting model type to custom_model")
148
+ with open(model_config_file, "r") as f:
149
+ model_config = yaml.safe_load(f)
150
+ model_config["publish"]["type"] = "custom_model"
151
+
152
+ with open(model_config_file, "w") as f:
153
+ yaml.dump(model_config, f)
154
+
142
155
  mutable_asset = AssetConfig(asset_config_file)
143
156
 
144
157
  return mutable_asset
@@ -162,7 +175,7 @@ def create_or_update_asset(readonly_asset: AssetConfig, config: RegistryConfig):
162
175
  )
163
176
 
164
177
  with tempfile.TemporaryDirectory() as mutable_asset_dir:
165
- mutable_asset = build_mutable_asset(base_asset=readonly_asset, mutable_asset_dir=mutable_asset_dir)
178
+ mutable_asset = build_mutable_asset(base_asset=readonly_asset, mutable_asset_dir=mutable_asset_dir, storage_overrides_exist=bool(config.storage_config))
166
179
  # autoincrement version
167
180
  try:
168
181
  set_storage_and_sas(mutable_asset, config.storage_config)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: azureml-registry-tools
3
- Version: 0.1.0a7
3
+ Version: 0.1.0a9
4
4
  Summary: AzureML Registry tools and CLI
5
5
  Author: Microsoft Corp
6
6
  License: https://aka.ms/azureml-sdk-license
@@ -15,10 +15,10 @@ azureml/registry/data/model-variant.schema.json,sha256=AT4Dy6cCtp_SFUfSqYIqcER8A
15
15
  azureml/registry/data/model.schema.json,sha256=sNzo7agu_49GdfSa08T61Hy87j-XY5IwLh6XU39QTAY,25814
16
16
  azureml/registry/data/model.yaml.template,sha256=h5uqAN22FLaWrbPxIb8yVKH9cGDBrIwooXYYfsKhxDw,245
17
17
  azureml/registry/data/notes.md.template,sha256=yFQ7qbrjlGDLZGuSoJUvQjctXsnCdoUd6txJuT-duCY,300
18
- azureml/registry/data/validate_model_schema.py,sha256=VLgQQhgS-lWuYC9bCBop_Yp1k70SzaM_8JU4Sc7aE14,5198
19
- azureml/registry/data/validate_model_variant_schema.py,sha256=4gpL9fTN4APu3TdrAUTzd3oavByBv19afjHbK__BEno,3583
18
+ azureml/registry/data/validate_model_schema.py,sha256=-13fTuX1iqO7OhZFv8NbBpPlBcs-plNYJVPu40Cgl5M,5236
19
+ azureml/registry/data/validate_model_variant_schema.py,sha256=JPVNtRBn6qciMu4PaRXOvS86OGGW0cocL2Rri4xYKo8,3629
20
20
  azureml/registry/mgmt/__init__.py,sha256=LMhqcEC8ItmmpKZljElGXH-6olHlT3SLl0dJU01OvuM,226
21
- azureml/registry/mgmt/asset_management.py,sha256=7dUp8Dg-YffAWBtqLK6l2to8lafcPfh5GB0aH7ujVsc,9911
21
+ azureml/registry/mgmt/asset_management.py,sha256=loe_RkzJYwFX0brG5OJfv4XpgHAvc28zSSukNA7FgT0,10714
22
22
  azureml/registry/mgmt/create_asset_template.py,sha256=ejwLuIsmzJOoUePoxbM-eGMg2E3QHfdX-nPMBzYUVMQ,3525
23
23
  azureml/registry/mgmt/create_manifest.py,sha256=N9wRmjAKO09A3utN_lCUsM_Ufpj7PL0SJz-XHPHWuyM,9528
24
24
  azureml/registry/mgmt/create_model_spec.py,sha256=1PdAcUf-LomvljoT8wKQihXMTLd7DoTgN0qDX4Lol1A,10473
@@ -29,9 +29,9 @@ azureml/registry/tools/config.py,sha256=tjPaoBsWtPXBL8Ww1hcJtsr2SuIjPKt79dR8iovc
29
29
  azureml/registry/tools/create_or_update_assets.py,sha256=Q-_BV7KWn1huQn5JriKT_8xJNoQQ_HK5wCftrq9DepA,15988
30
30
  azureml/registry/tools/registry_utils.py,sha256=zgYlCiOONtQJ4yZ9wg8tKVoE8dh6rrjB8hYBGhpV9-0,1403
31
31
  azureml/registry/tools/repo2registry_config.py,sha256=eXp_tU8Jyi30g8xGf7wbpLgKEPpieohBANKxMSLzq7s,4873
32
- azureml_registry_tools-0.1.0a7.dist-info/licenses/LICENSE.txt,sha256=n20rxwp7_NGrrShv9Qvcs90sjI1l3Pkt3m-5OPCWzgs,845
33
- azureml_registry_tools-0.1.0a7.dist-info/METADATA,sha256=R1Pk35pE-6ocXl6mlW3DBOKa-6SJ2XMM27bOlJLpjhI,521
34
- azureml_registry_tools-0.1.0a7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- azureml_registry_tools-0.1.0a7.dist-info/entry_points.txt,sha256=iRUkAeQidMnO6RQzpLqMUBTcyYtNzAfSin9WnSdVGLw,147
36
- azureml_registry_tools-0.1.0a7.dist-info/top_level.txt,sha256=ZOeEa0TAXo6i5wOjwBoqfIGEuxOcKuscGgNSpizqREY,8
37
- azureml_registry_tools-0.1.0a7.dist-info/RECORD,,
32
+ azureml_registry_tools-0.1.0a9.dist-info/licenses/LICENSE.txt,sha256=n20rxwp7_NGrrShv9Qvcs90sjI1l3Pkt3m-5OPCWzgs,845
33
+ azureml_registry_tools-0.1.0a9.dist-info/METADATA,sha256=rlJEImnW42AWIfYYtpiN6TLkRjAkFg8KWQu3sTc5mRo,521
34
+ azureml_registry_tools-0.1.0a9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ azureml_registry_tools-0.1.0a9.dist-info/entry_points.txt,sha256=iRUkAeQidMnO6RQzpLqMUBTcyYtNzAfSin9WnSdVGLw,147
36
+ azureml_registry_tools-0.1.0a9.dist-info/top_level.txt,sha256=ZOeEa0TAXo6i5wOjwBoqfIGEuxOcKuscGgNSpizqREY,8
37
+ azureml_registry_tools-0.1.0a9.dist-info/RECORD,,