|
4 | 4 |
|
5 | 5 | import parsl |
6 | 6 | from parsl.app.app import python_app |
7 | | -from parsl.tests.configs.taskvine_ex import fresh_config |
8 | 7 |
|
9 | 8 | try: |
10 | 9 | import ndcctools.taskvine # noqa: F401 |
@@ -42,32 +41,30 @@ def test_function_context_computation(num_tasks, current_config_name): |
42 | 41 | pytest.skip("Skip tests as these are exclusively for TaskVineExecutor.") |
43 | 42 | input_file_names = ['input1.test_taskvine_context.data', 'input2.test_taskvine_context.data'] |
44 | 43 | try: |
45 | | - config = fresh_config() |
46 | | - with parsl.load(config): |
47 | | - input_data = [7, 8] |
48 | | - for i, file_name in enumerate(input_file_names): |
49 | | - with open(file_name, 'w') as f: |
50 | | - print(input_data[i], file=f) |
| 44 | + input_data = [7, 8] |
| 45 | + for i, file_name in enumerate(input_file_names): |
| 46 | + with open(file_name, 'w') as f: |
| 47 | + print(input_data[i], file=f) |
51 | 48 |
|
52 | | - futs = [] |
53 | | - x = 5 |
54 | | - y = 1 |
55 | | - function_context_input_files = {} |
56 | | - for v in input_file_names: |
57 | | - function_context_input_files[v] = v |
58 | | - for _ in range(num_tasks): |
59 | | - futs.append(f_compute(x, |
60 | | - parsl_resource_specification={ |
61 | | - 'exec_mode': 'serverless', |
62 | | - 'function_context': f_context, |
63 | | - 'function_context_args': [y, input_file_names], |
64 | | - 'function_context_input_files': function_context_input_files})) |
65 | | - total_sum = 0 |
66 | | - for i in range(num_tasks): |
67 | | - total_sum += futs[i].result() |
| 49 | + futs = [] |
| 50 | + x = 5 |
| 51 | + y = 1 |
| 52 | + function_context_input_files = {} |
| 53 | + for v in input_file_names: |
| 54 | + function_context_input_files[v] = v |
| 55 | + for _ in range(num_tasks): |
| 56 | + futs.append(f_compute(x, |
| 57 | + parsl_resource_specification={ |
| 58 | + 'exec_mode': 'serverless', |
| 59 | + 'function_context': f_context, |
| 60 | + 'function_context_args': [y, input_file_names], |
| 61 | + 'function_context_input_files': function_context_input_files})) |
| 62 | + total_sum = 0 |
| 63 | + for i in range(num_tasks): |
| 64 | + total_sum += futs[i].result() |
68 | 65 |
|
69 | | - expected = (f_compute(x) + f_context(y, input_file_names)['y']) * num_tasks |
70 | | - assert total_sum == expected |
| 66 | + expected = (f_compute(x) + f_context(y, input_file_names)['y']) * num_tasks |
| 67 | + assert total_sum == expected |
71 | 68 | finally: |
72 | 69 | for file_name in input_file_names: |
73 | 70 | os.remove(file_name) |
0 commit comments