Skip to content

Commit

Permalink
Merge pull request #142 from sneaky0potato/resolve-merge-conflicts
Browse files Browse the repository at this point in the history
Resolve merge conflicts
  • Loading branch information
svaradh authored May 23, 2024
2 parents af1c240 + 82f664b commit afc6aef
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 21 deletions.
9 changes: 8 additions & 1 deletion litesoph/common/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ def run_job_local(self,cmd):
def connect_to_network(self, *args, **kwargs):
self.submit_network = SubmitNetwork(self, *args, **kwargs)

def run_job_network():
def run_job_network(self,):
pass

def post_run(self,):
"""
Called at the end of the task when proceed button is pressed.
Usually to copy engine files to task directory, write the code here.
"""
pass

def read_log(self, file):
Expand Down
4 changes: 2 additions & 2 deletions litesoph/common/workflows_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class step:
'properties':['mo_population'],
},
{'laser': True}),
step(2 ,2 ,tt.COMPUTE_SPECTRUM),
step(3 ,3 ,tt.MO_POPULATION)],
step(2 ,2 ,tt.MO_POPULATION),
],

"dependency_map": {'0' : None,
'1' : '0',
Expand Down
3 changes: 2 additions & 1 deletion litesoph/engines/gpaw/gpaw_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"atoms.center(vacuum={vacuum})\n",

"""
initial_calc = GPAW(mode='{mode}', xc='{xc}', txt='no_of_electrons.out')
#This initial_calc is just to compute the no. of electrons. The gs and td will take the params inputted by the user.
initial_calc = GPAW(mode='lcao', xc='PBE', txt='no_of_electrons.out')
atoms.set_calculator(initial_calc)
atoms.get_potential_energy()
Expand Down
8 changes: 5 additions & 3 deletions litesoph/engines/octopus/octopus_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ def get_engine_log(self):
def plot(self,**kwargs):
"""Method related to plot in post-processing"""

self.post_run()

if self.task_name == tt.COMPUTE_SPECTRUM:
energy_min = self.task_info.param['e_min']
energy_max = self.task_info.param['e_max']
Expand Down Expand Up @@ -507,8 +509,6 @@ def run_job_local(self,cmd):
return
cmd = cmd + ' ' + self.BASH_filename
self.submit_local.run_job(cmd)
if self.check_run_status()[0]:
self.post_run()

def get_ksd_popln(self):
td_info = self.dependent_tasks[1]
Expand Down Expand Up @@ -628,6 +628,7 @@ def compute_avg_spectra(self):
def plot(self, data_type='average', **kwargs):
"""Method to plot average, summed, or subtracted spectrum based on polarization status."""
from litesoph.visualization.plot_spectrum import plot_spectrum
self.post_run()

energy_min = self.task_info.param['e_min']
energy_max = self.task_info.param['e_max']
Expand Down Expand Up @@ -716,7 +717,8 @@ def generate_tas_data(self):
delay_list,spectrum_data_list=get_spectrums_delays(self.task_info,self.dependent_tasks,self.project_dir,self.only_workflow_dirpath)
prepare_tas_data(spectrum_data_list,delay_list,contour_x_data_file,contour_y_data_file,contour_z_data_file)

def plot(self,delay_min=None,delay_max=None,freq_min=None,freq_max=None):
def plot(self,delay_min=None,delay_max=None,freq_min=None,freq_max=None):
self.post_run()
from litesoph.visualization.plot_spectrum import contour_plot
x_data = np.loadtxt(self.project_dir.parent /self.only_workflow_dirpath/ (self.task_info.output.get('contour_x_data')))
y_data = np.loadtxt(self.project_dir.parent /self.only_workflow_dirpath/ (self.task_info.output.get('contour_y_data')))
Expand Down
47 changes: 33 additions & 14 deletions litesoph/gui/workflow_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,31 @@ def start(self, workflow_manager: WorkflowManager):
self.task_mode_workflow = self.workflow_manager.task_mode
self.workmanager_page = self.project_controller.workmanager_page
self.start_task()


def check_pg(self):
# Make it False so that you can queue multiple jobs.
# Change to True under parental guidance only
PG_PROCEED = False
if hasattr(self.task_controller.task, 'submit_network') and self.task_controller.task.submit_network is not None:
is_remote_job_done = PG_PROCEED or (self.task_controller.task.submit_network.check_job_status())
if not is_remote_job_done:
messagebox.showwarning(title='Warning', message="The task has not yet completed. Please wait for the task to complete on the remote machine.")
# TODO: Check if the task output is valid or not?
# messagebox.showerror(title= 'Error', message = "Task output is not valid.")
return True
return False

def show_workmanager_page(self, *_):
if hasattr(self, 'task_controller') and self.check_pg():
return
try:
self.task_controller.task.post_run()
except:
messagebox.showwarning(
title = "Warning",
message = "There was some error running post run tasks for current task."+
"Possiblity that some output files couldn't be copyied to task folder."
)
self.workmanager_page._var['select_wf_option'].set(value=2)
self.workmanager_page.tkraise()
self.app.proceed_button.config(command= self.start_task, state = 'normal')
Expand Down Expand Up @@ -262,23 +284,20 @@ def start_task(self, *_):
self.workflow_navigation_view.start(block_id)
self.task_controller.set_task(self.workflow_manager, task_view)

def check_pg(self):
# Make it False so that you can queue multiple jobs.
PG_PROCEED = False
if hasattr(self.task_controller.task, 'submit_network') and self.task_controller.task.submit_network is not None:
is_remote_job_done = PG_PROCEED or (self.task_controller.task.submit_network.check_job_status())
if not is_remote_job_done:
messagebox.showwarning(title='Warning', message="The task has not yet completed. Please wait for the task to complete on the remote machine.")
# TODO: Check if the task output is valid or not?
# messagebox.showerror(title= 'Error', message = "Task output is not valid.")
return True
return False

def next_task(self):
# Make it False so that you can queue multiple jobs.
if self.check_pg():
return
self.app.proceed_button.config(state = 'disabled')

try:
self.task_controller.task.post_run()
except:
messagebox.showwarning(
title = "Warning",
message = "There was some error running post run tasks for current task."+
"Possiblity that some output files couldn't be copyied to task folder."
)
try:
self.workflow_manager.next()
except TaskSetupError as e:
Expand Down Expand Up @@ -307,4 +326,4 @@ def get_task_controller( task_view, workflow_controller, app) -> TaskController:
else:
task_controller = TaskController

return task_controller(workflow_controller, app)
return task_controller(workflow_controller, app)

0 comments on commit afc6aef

Please sign in to comment.