Browse Source

Add report egeneration to pkar_watch.

scossu 2 days ago
parent
commit
9b9d1d24cc
2 changed files with 10 additions and 4 deletions
  1. 1 0
      src/submission.lua
  2. 9 4
      src/util/watcher.lua

+ 1 - 0
src/submission.lua

@@ -442,6 +442,7 @@ local function generate_report(rpath, report)
         local fh = io.open(rpath, "w")
         fh:write(json.encode(report))
         fh:close()
+        logger:info("Report written to " .. rpath)
         return true
     else return report end
 end

+ 9 - 4
src/util/watcher.lua

@@ -1,7 +1,7 @@
 #!/usr/bin/lua
 
 local cli = require "cli"
-local plpath = require "pl.path"
+local path = require "pl.path"
 local posix = require "posix"
 local signal = require "posix.signal"
 local sllog = require "sllog"
@@ -31,6 +31,9 @@ cli.program {
 
     NOTE: LL files MUST be dropped AFTER all files in the submission package
     have been successfully uploaded.
+
+    A report with the same base name as the LL file is automatically generated
+    and dropped into the submission folder.
     ]],
 
     cli.positional "path" {"Local path of folder to watch."},
@@ -54,7 +57,7 @@ cli.program {
         type = cli.boolean,
     },
 
-    cli.flag "r,del-members" {
+    cli.flag "r,rm-members" {
         "Remove resource members recursively.",
         type = cli.boolean,
     },
@@ -91,10 +94,12 @@ cli.program {
                 elseif cpid == 0 then
                     local mypid = unistd.getpid()
                     logger:info("Starting submission with pid: " .. mypid)
+                    local fpath = path.join(args.path, ev.name)
                     local sub_rc, sub_ret = pcall(
                         sub.deposit,
-                        plpath.join(args.path, ev.name),
-                        args.cleanup
+                        fpath,
+                        args.cleanup,
+                        fpath:gsub("%.csv$", "-report.json")
                     )
                     if sub_rc then
                         local report = sub_ret