@@ -116,69 +116,68 @@ jobs:
116116 run : |
117117 echo "🚀 Checking model deployment status..."
118118
119- python -c "
119+ python3 << 'EOF'
120120 from clearml import Model
121121 import sys
122122
123123 try:
124124 print('🔍 Searching for deployed models...')
125125
126- # Check for deployed models directly
127- models = Model.query_models(
126+ # First check for any published models
127+ all_models = Model.query_models(
128128 project_name='Guardian_Training',
129- tags=['deployed', 'production', 'github-actions'] ,
129+ model_name='BiLSTM_ActionRecognition' ,
130130 only_published=True,
131- max_results=1 ,
131+ max_results=5 ,
132132 order_by=['-created']
133133 )
134134
135- if not models:
136- print('❌ No deployed models found with deployment tags')
135+ print(f'📋 Found {len(all_models)} published models')
136+
137+ deployed_model = None
138+ for model in all_models:
139+ print(f' Model ID: {model.id}')
140+ print(f' Created: {model.created}')
141+ print(f' Tags: {model.tags}')
137142
138- # Try to find any recent models
139- print('🔍 Searching for any recent models...')
140- recent_models = Model.query_models(
141- project_name='Guardian_Training',
142- model_name='BiLSTM_ActionRecognition',
143- max_results=3,
144- order_by=['-created']
145- )
143+ # Check if this model has deployment tags
144+ if model.tags and any(tag in ['deployed', 'production'] for tag in model.tags):
145+ deployed_model = model
146+ break
147+
148+ if deployed_model:
149+ print(f'✅ Found deployed model!')
150+ print(f'🏷️ Model ID: {deployed_model.id}')
151+ print(f'📅 Created: {deployed_model.created}')
152+ print(f'🏷️ Tags: {deployed_model.tags}')
146153
147- if recent_models:
148- print(f'📋 Found {len(recent_models)} recent models:')
149- for i, m in enumerate(recent_models):
150- print(f' {i+1}. Model ID: {m.id}')
151- print(f' Created: {m.created}')
152- print(f' Published: {m.published}')
153- print(f' Tags: {m.tags}')
154+ # Try to get model metadata
155+ try:
156+ design = deployed_model.get_model_design()
157+ if design and 'test_accuracy' in design:
158+ accuracy = design['test_accuracy']
159+ print(f'📊 Test Accuracy: {accuracy:.2f}%')
160+ else:
161+ print('📊 Test Accuracy: Not available in model metadata')
162+ except Exception as e:
163+ print(f'⚠️ Could not get model design: {e}')
164+ else:
165+ print('❌ No deployed models found')
166+ if all_models:
167+ print('⚠️ Found published models but none are marked as deployed')
168+ latest = all_models[0]
169+ print(f' Latest model: {latest.id}')
170+ print(f' Created: {latest.created}')
154171 else:
155- print('❌ No models found at all')
156-
172+ print('❌ No published models found at all')
157173 sys.exit(1)
158-
159- model = models[0]
160- print(f'✅ Found deployed model!')
161- print(f'🏷️ Model ID: {model.id}')
162- print(f'📅 Created: {model.created}')
163- print(f'🏷️ Tags: {model.tags}')
164-
165- # Get model metadata for accuracy
166- try:
167- design = model.get_model_design()
168- if design and 'test_accuracy' in design:
169- accuracy = design['test_accuracy']
170- print(f'📊 Test Accuracy: {accuracy:.2f}%')
171- else:
172- print('📊 Test Accuracy: Not available in model metadata')
173- except Exception as e:
174- print(f'⚠️ Could not get model design: {e}')
175174
176175 except Exception as e:
177176 print(f'❌ Error checking deployment: {e}')
178177 import traceback
179178 traceback.print_exc()
180179 sys.exit(1)
181- "
180+ EOF
182181
183182 - name : Notify deployment success
184183 if : success()
0 commit comments