Skip to content

Commit

Permalink
Merge pull request #67 from sneaky0potato/main
Browse files Browse the repository at this point in the history
Fixed `fd` for task mode and added pg_check for task mode
  • Loading branch information
sneaky0potato authored May 20, 2024
2 parents 2692054 + 50b61bc commit 1949dfd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 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
2 changes: 0 additions & 2 deletions litesoph/engines/octopus/octopus_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,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
44 changes: 31 additions & 13 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,19 @@ 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

0 comments on commit 1949dfd

Please sign in to comment.