Skip to content

Commit

Permalink
Change "Task" to "Method" to be consistent with queues
Browse files Browse the repository at this point in the history
  • Loading branch information
WardLT committed Mar 8, 2024
1 parent d9e2f73 commit fb4f848
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 343 deletions.
317 changes: 0 additions & 317 deletions colmena/models/tasks.py

This file was deleted.

10 changes: 5 additions & 5 deletions colmena/task_server/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Collection, Optional, Callable, Union

from colmena.exceptions import KillSignalException, TimeoutException
from colmena.models.tasks import ColmenaTask, PythonGeneratorTask, PythonTask
from colmena.models.methods import ColmenaMethod, PythonGeneratorMethod, PythonMethod
from colmena.models import Result, FailureInformation
from colmena.queue.base import ColmenaQueues

Expand Down Expand Up @@ -161,7 +161,7 @@ def process_queue(self, topic: str, task: Result):
future.add_done_callback(lambda x: self.perform_callback(x, task, topic))


def convert_to_colmena_task(function: Union[Callable, ColmenaTask]) -> ColmenaTask:
def convert_to_colmena_method(function: Union[Callable, ColmenaMethod]) -> ColmenaMethod:
"""Wrap user-supplified functions in the task model wrapper, if needed
Args:
Expand All @@ -170,9 +170,9 @@ def convert_to_colmena_task(function: Union[Callable, ColmenaTask]) -> ColmenaTa
Function as appropriate subclasses of Colmena Task wrapper
"""

if isinstance(function, ColmenaTask):
if isinstance(function, ColmenaMethod):
return function
elif isgeneratorfunction(function):
return PythonGeneratorTask(function)
return PythonGeneratorMethod(function)
else:
return PythonTask(function)
return PythonMethod(function)
4 changes: 2 additions & 2 deletions colmena/task_server/globus.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from globus_compute_sdk import Client, Executor

from colmena.task_server.base import convert_to_colmena_task, FutureBasedTaskServer
from colmena.task_server.base import convert_to_colmena_method, FutureBasedTaskServer
from colmena.queue.python import PipeQueues

from colmena.models import Result
Expand Down Expand Up @@ -58,7 +58,7 @@ def __init__(self,
self.registered_funcs: Dict[str, Tuple[str, str]] = {} # Function name -> (funcX id, endpoints)
for func, endpoint in methods.items():
# Register a wrapped version of the function
task = convert_to_colmena_task(func)
task = convert_to_colmena_method(func)
func_fxid = self.fx_client.register_function(task)

# Store the information for the function
Expand Down
Loading

0 comments on commit fb4f848

Please sign in to comment.