@@ -157,6 +157,57 @@ def execute(self, log_out, log_err):
157
157
return proc .returncode
158
158
159
159
160
+
161
+ class SQLiteProc (Component ):
162
+ """!
163
+ Copy the SQLite database file to the desired location.
164
+ """
165
+
166
+ def __init__ (self , ** kwargs ):
167
+ """!
168
+ Initialize SQLiteProc to copy the SQLite file.
169
+ """
170
+
171
+ self .source_file = '/w/hallb-scshelf2102/hps/zshi/swiftjob/SQLite/LocalTest/hps_conditions_2025_03_06.sqlite'
172
+ self .destination_file = './hps_conditions_2025_03_06.sqlite' # Modify this as needed
173
+
174
+
175
+ # Ensure to call the parent constructor properly
176
+ Component .__init__ (self , name = 'sqlite_file_copy' , ** kwargs )
177
+
178
+
179
+ def cmd_args (self ):
180
+ """!
181
+ Return dummy command arguments to satisfy the parent class.
182
+ """
183
+ cmd_args = ["(no-command-needed)" ]
184
+
185
+ if not all (isinstance (arg , str ) for arg in cmd_args ):
186
+ raise ValueError ("All arguments must be strings." )
187
+ # return ["(no-command-needed)"]
188
+ return ['--source' , self .source_file , '--destination' , self .destination_file ]
189
+
190
+ def execute (self , log_out , log_err ):
191
+ """!
192
+ Execute the file copy operation.
193
+ """
194
+
195
+ try :
196
+ # Copy the file
197
+
198
+ self .logger .info (f"Copying file from { self .source_file } to { self .destination_file } " )
199
+ shutil .copy (self .source_file , self .destination_file )
200
+
201
+ # Log success
202
+ self .logger .info (f"Successfully copied file to { self .destination_file } " )
203
+
204
+ return 0 # Success code
205
+
206
+ except Exception as e :
207
+ self .logger .error (f"Error during file copy: { e } " )
208
+ return 1 # Error code
209
+
210
+
160
211
class JobManager (Component ):
161
212
"""!
162
213
Run the hps-java JobManager class.
0 commit comments