Example of a future_scan creation in a python widget#
This is the simplest script you can create in order to generate a FutureTomwerScan from a python script.
from distributed import Client
from tomwer.core.cluster import SlurmClusterManager
from tomwer.core.scan.futurescan import FutureTomwerScan
cluster_configuration = in_configuration
# create a cluster
cluster = SlurmClusterManager().get_cluster(
cluster_configuration,
project_name="my awesome project",
)
def my_pprint(*args):
print(args)
# submit job
future_slurm_job = client.submit(
my_pprint,
"this",
"will",
"be",
"print",
)
# create tomwer future scan
# note: once future scan is done it can be converted back to tomwer
future_data_out = FutureTomwerScan(
scan=in_data,
futures=[
future_slurm_job,
],
)