MCPcopy
hub / github.com/psycopg/psycopg / copy_task

Function copy_task

tests/test_copy.py:971–993  ·  view source on GitHub ↗

Copy task that writes two rows with controlled pauses.

()

Source from the content-addressed store, hash-verified

969 execution_log = []
970
971 def copy_task():
972 """Copy task that writes two rows with controlled pauses."""
973 cur = conn.cursor()
974 with cur.copy("copy copy_concurrency_test from stdin") as copy:
975 # Pause after entering copy context
976 execution_log.append("entered_copy")
977 copy_entered.set()
978 can_proceed.wait()
979
980 # Write first row and pause
981 copy.write_row((1, "first"))
982 execution_log.append("wrote_row_1")
983 wrote_first.set()
984 can_proceed.wait()
985
986 # Write second row and pause
987 copy.write_row((2, "second"))
988 execution_log.append("wrote_row_2")
989 wrote_second.set()
990 can_proceed.wait()
991
992 # Copy context exited, lock should now be released
993 execution_log.append("exited_copy")
994
995 def worker_task():
996 """

Callers

nothing calls this directly

Calls 5

cursorMethod · 0.45
copyMethod · 0.45
setMethod · 0.45
waitMethod · 0.45
write_rowMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…