---------------------------------------------------------------------------
InvalidInputException Traceback (most recent call last)
Cell In[21], line 1
----> 1 what = cytotable.convert(
2 source_path=manifest_df.sqlite_file[2],
3 dest_path="test.parquet",
4 dest_datatype="parquet"
5 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/cytotable/convert.py:942, in convert(source_path, dest_path, dest_datatype, source_datatype, metadata, compartments, identifying_columns, concat, join, joins, chunk_columns, chunk_size, infer_common_schema, drop_null, preset, task_runner, log_level, **kwargs)
940 # send sources to be written to parquet if selected
941 if dest_datatype == "parquet":
--> 942 output = _to_parquet.with_options(task_runner=task_runner)(
943 source_path=source_path,
944 dest_path=dest_path,
945 source_datatype=source_datatype,
946 metadata=metadata,
947 compartments=compartments,
948 identifying_columns=identifying_columns,
949 concat=concat,
950 join=join,
951 joins=joins,
952 chunk_columns=chunk_columns,
953 chunk_size=chunk_size,
954 infer_common_schema=infer_common_schema,
955 drop_null=drop_null,
956 **kwargs,
957 )
959 return output
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/flows.py:468, in Flow.__call__(self, return_state, wait_for, *args, **kwargs)
464 parameters = get_call_parameters(self.fn, args, kwargs)
466 return_type = "state" if return_state else "result"
--> 468 return enter_flow_run_engine_from_flow_call(
469 self,
470 parameters,
471 wait_for=wait_for,
472 return_type=return_type,
473 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:184, in enter_flow_run_engine_from_flow_call(flow, parameters, wait_for, return_type)
179 retval = from_async.wait_for_call_in_loop_thread(
180 begin_run, done_callbacks=done_callbacks
181 )
183 else:
--> 184 retval = from_sync.wait_for_call_in_loop_thread(
185 begin_run, done_callbacks=done_callbacks
186 )
188 return retval
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/api.py:137, in from_sync.wait_for_call_in_loop_thread(call, timeout, done_callbacks)
135 waiter.add_done_callback(callback)
136 waiter.wait()
--> 137 return call.result()
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:173, in Call.result(self, timeout)
167 def result(self, timeout: Optional[float] = None) -> T:
168 """
169 Wait for the result of the call.
170
171 Not safe for use from asynchronous contexts.
172 """
--> 173 return self.future.result(timeout=timeout)
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout)
449 raise CancelledError()
450 elif self._state == FINISHED:
--> 451 return self.__get_result()
453 self._condition.wait(timeout)
455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
406 self = None
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:218, in Call._run_async(***failed resolving arguments***)
216 logger.debug("%r using async cancel scope %r", self, ctx)
217 ctx.chain(self.cancel_context, bidirectional=True)
--> 218 result = await coro
219 except BaseException as exc:
220 logger.debug("Encountered exception in async call %r", self, exc_info=True)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/client/utilities.py:40, in inject_client.<locals>.with_injected_client(*args, **kwargs)
38 async with client_context as new_client:
39 kwargs.setdefault("client", new_client or client)
---> 40 return await fn(*args, **kwargs)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:258, in create_then_begin_flow_run(flow, parameters, wait_for, return_type, client)
256 return state
257 elif return_type == "result":
--> 258 return await state.result(fetch=True)
259 else:
260 raise ValueError(f"Invalid return type for flow engine {return_type!r}.")
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/states.py:91, in _get_state_result(state, raise_on_failure)
86 raise PausedRun("Run paused.")
88 if raise_on_failure and (
89 state.is_crashed() or state.is_failed() or state.is_cancelled()
90 ):
---> 91 raise await get_state_exception(state)
93 if isinstance(state.data, DataDocument):
94 result = result_from_state_with_data_document(
95 state, raise_on_failure=raise_on_failure
96 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:669, in orchestrate_flow_run(flow, flow_run, parameters, wait_for, interruptible, client, partial_flow_run_context)
664 else:
665 from_async.call_soon_in_new_thread(
666 flow_call, timeout=flow.timeout_seconds
667 )
--> 669 result = await flow_call.aresult()
671 waited_for_task_runs = await wait_for_task_runs_and_report_crashes(
672 flow_run_context.task_run_futures, client=client
673 )
674 except PausedRun:
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:181, in Call.aresult(self)
175 async def aresult(self):
176 """
177 Wait for the result of the call.
178
179 For use from asynchronous contexts.
180 """
--> 181 return await asyncio.wrap_future(self.future)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:194, in Call._run_sync(***failed resolving arguments***)
192 with cancel_sync_at(self.cancel_context.deadline) as ctx:
193 ctx.chain(self.cancel_context, bidirectional=True)
--> 194 result = self.fn(*self.args, **self.kwargs)
196 # Return the coroutine for async execution
197 if inspect.isawaitable(result):
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/cytotable/convert.py:695, in _to_parquet(source_path, dest_path, source_datatype, metadata, compartments, identifying_columns, concat, join, joins, chunk_columns, chunk_size, infer_common_schema, drop_null, **kwargs)
652 """
653 Export data to parquet.
654
(...)
691 result.
692 """
694 # gather sources to be processed
--> 695 sources = _gather_sources(
696 source_path=source_path,
697 source_datatype=source_datatype,
698 targets=list(metadata) + list(compartments),
699 **kwargs,
700 )
702 if not isinstance(sources, Dict):
703 sources = sources.result()
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/flows.py:468, in Flow.__call__(self, return_state, wait_for, *args, **kwargs)
464 parameters = get_call_parameters(self.fn, args, kwargs)
466 return_type = "state" if return_state else "result"
--> 468 return enter_flow_run_engine_from_flow_call(
469 self,
470 parameters,
471 wait_for=wait_for,
472 return_type=return_type,
473 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:184, in enter_flow_run_engine_from_flow_call(flow, parameters, wait_for, return_type)
179 retval = from_async.wait_for_call_in_loop_thread(
180 begin_run, done_callbacks=done_callbacks
181 )
183 else:
--> 184 retval = from_sync.wait_for_call_in_loop_thread(
185 begin_run, done_callbacks=done_callbacks
186 )
188 return retval
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/api.py:137, in from_sync.wait_for_call_in_loop_thread(call, timeout, done_callbacks)
135 waiter.add_done_callback(callback)
136 waiter.wait()
--> 137 return call.result()
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:173, in Call.result(self, timeout)
167 def result(self, timeout: Optional[float] = None) -> T:
168 """
169 Wait for the result of the call.
170
171 Not safe for use from asynchronous contexts.
172 """
--> 173 return self.future.result(timeout=timeout)
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout)
449 raise CancelledError()
450 elif self._state == FINISHED:
--> 451 return self.__get_result()
453 self._condition.wait(timeout)
455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
406 self = None
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:218, in Call._run_async(***failed resolving arguments***)
216 logger.debug("%r using async cancel scope %r", self, ctx)
217 ctx.chain(self.cancel_context, bidirectional=True)
--> 218 result = await coro
219 except BaseException as exc:
220 logger.debug("Encountered exception in async call %r", self, exc_info=True)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/client/utilities.py:40, in inject_client.<locals>.with_injected_client(*args, **kwargs)
38 async with client_context as new_client:
39 kwargs.setdefault("client", new_client or client)
---> 40 return await fn(*args, **kwargs)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:566, in create_and_begin_subflow_run(flow, parameters, wait_for, return_type, client)
564 return terminal_state
565 elif return_type == "result":
--> 566 return await terminal_state.result(fetch=True)
567 else:
568 raise ValueError(f"Invalid return type for flow engine {return_type!r}.")
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/states.py:91, in _get_state_result(state, raise_on_failure)
86 raise PausedRun("Run paused.")
88 if raise_on_failure and (
89 state.is_crashed() or state.is_failed() or state.is_cancelled()
90 ):
---> 91 raise await get_state_exception(state)
93 if isinstance(state.data, DataDocument):
94 result = result_from_state_with_data_document(
95 state, raise_on_failure=raise_on_failure
96 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:669, in orchestrate_flow_run(flow, flow_run, parameters, wait_for, interruptible, client, partial_flow_run_context)
664 else:
665 from_async.call_soon_in_new_thread(
666 flow_call, timeout=flow.timeout_seconds
667 )
--> 669 result = await flow_call.aresult()
671 waited_for_task_runs = await wait_for_task_runs_and_report_crashes(
672 flow_run_context.task_run_futures, client=client
673 )
674 except PausedRun:
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:181, in Call.aresult(self)
175 async def aresult(self):
176 """
177 Wait for the result of the call.
178
179 For use from asynchronous contexts.
180 """
--> 181 return await asyncio.wrap_future(self.future)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:194, in Call._run_sync(***failed resolving arguments***)
192 with cancel_sync_at(self.cancel_context.deadline) as ctx:
193 ctx.chain(self.cancel_context, bidirectional=True)
--> 194 result = self.fn(*self.args, **self.kwargs)
196 # Return the coroutine for async execution
197 if inspect.isawaitable(result):
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/cytotable/sources.py:215, in _gather_sources(source_path, source_datatype, targets, **kwargs)
212 source_path = _build_path(path=source_path, **kwargs)
214 # gather filepaths which will be used as the basis for this work
--> 215 sources = _get_source_filepaths(
216 path=source_path, source_datatype=source_datatype, targets=targets
217 )
219 # infer or validate the source datatype based on source filepaths
220 source_datatype = _infer_source_datatype(
221 sources=sources, source_datatype=source_datatype
222 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/tasks.py:485, in Task.__call__(self, return_state, wait_for, *args, **kwargs)
481 parameters = get_call_parameters(self.fn, args, kwargs)
483 return_type = "state" if return_state else "result"
--> 485 return enter_task_run_engine(
486 self,
487 parameters=parameters,
488 wait_for=wait_for,
489 task_runner=SequentialTaskRunner(),
490 return_type=return_type,
491 mapped=False,
492 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:972, in enter_task_run_engine(task, parameters, wait_for, return_type, task_runner, mapped)
970 return from_async.wait_for_call_in_loop_thread(begin_run)
971 else:
--> 972 return from_sync.wait_for_call_in_loop_thread(begin_run)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/api.py:137, in from_sync.wait_for_call_in_loop_thread(call, timeout, done_callbacks)
135 waiter.add_done_callback(callback)
136 waiter.wait()
--> 137 return call.result()
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:173, in Call.result(self, timeout)
167 def result(self, timeout: Optional[float] = None) -> T:
168 """
169 Wait for the result of the call.
170
171 Not safe for use from asynchronous contexts.
172 """
--> 173 return self.future.result(timeout=timeout)
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout)
449 raise CancelledError()
450 elif self._state == FINISHED:
--> 451 return self.__get_result()
453 self._condition.wait(timeout)
455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~/miniforge3/envs/jump_sc/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
406 self = None
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:218, in Call._run_async(***failed resolving arguments***)
216 logger.debug("%r using async cancel scope %r", self, ctx)
217 ctx.chain(self.cancel_context, bidirectional=True)
--> 218 result = await coro
219 except BaseException as exc:
220 logger.debug("Encountered exception in async call %r", self, exc_info=True)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:1137, in get_task_call_return_value(task, flow_run_context, parameters, wait_for, return_type, task_runner, extra_task_inputs)
1135 return await future._wait()
1136 elif return_type == "result":
-> 1137 return await future._result()
1138 else:
1139 raise ValueError(f"Invalid return type for task engine {return_type!r}.")
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/futures.py:241, in PrefectFuture._result(self, timeout, raise_on_failure)
239 if not final_state:
240 raise TimeoutError("Call timed out before task finished.")
--> 241 return await final_state.result(raise_on_failure=raise_on_failure, fetch=True)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/states.py:91, in _get_state_result(state, raise_on_failure)
86 raise PausedRun("Run paused.")
88 if raise_on_failure and (
89 state.is_crashed() or state.is_failed() or state.is_cancelled()
90 ):
---> 91 raise await get_state_exception(state)
93 if isinstance(state.data, DataDocument):
94 result = result_from_state_with_data_document(
95 state, raise_on_failure=raise_on_failure
96 )
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/engine.py:1551, in orchestrate_task_run(task, task_run, parameters, wait_for, result_factory, log_prints, interruptible, client)
1544 logger.debug(
1545 f"Beginning execution...", extra={"state_message": True}
1546 )
1548 call = from_async.call_soon_in_new_thread(
1549 create_call(task.fn, *args, **kwargs)
1550 )
-> 1551 result = await call.aresult()
1553 except Exception as exc:
1554 name = message = None
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:181, in Call.aresult(self)
175 async def aresult(self):
176 """
177 Wait for the result of the call.
178
179 For use from asynchronous contexts.
180 """
--> 181 return await asyncio.wrap_future(self.future)
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py:194, in Call._run_sync(***failed resolving arguments***)
192 with cancel_sync_at(self.cancel_context.deadline) as ctx:
193 ctx.chain(self.cancel_context, bidirectional=True)
--> 194 result = self.fn(*self.args, **self.kwargs)
196 # Return the coroutine for async execution
197 if inspect.isawaitable(result):
File ~/miniforge3/envs/jump_sc/lib/python3.10/site-packages/cytotable/sources.py:70, in _get_source_filepaths(path, targets, source_datatype)
50 """
51 Gather dataset of filepaths from a provided directory path.
52
(...)
64 Data structure which groups related files based on the compartments.
65 """
67 if source_datatype == "sqlite" or (path.is_file() and path.suffix == ".sqlite"):
68 return {
69 f"{table_name}.sqlite": [{"table_name": table_name, "source_path": path}]
---> 70 for table_name in _duckdb_with_sqlite()
71 .execute(
72 """
73 /* perform query on sqlite_master table for metadata on tables */
74 SELECT name as table_name
75 from sqlite_scan(?, 'sqlite_master')
76 where type='table'
77 """,
78 parameters=[str(path)],
79 )
80 .arrow()["table_name"]
81 .to_pylist()
82 if any(target.lower() in table_name.lower() for target in targets)
83 }
85 # gathers files from provided path using compartments as a filter
86 sources = [
87 {"source_path": file}
88 for file in path.glob("**/*")
(...)
93 )
94 ]
InvalidInputException: Invalid Input Error: Attempting to execute an unsuccessful or closed pending query result
Error: Invalid Error: unable to open database file