Skip to content

Commit

Permalink
Remove unnecessary fields from CommandLinker
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Nov 1, 2024
1 parent 6310d85 commit 09ed00e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/MCPClient/lib/clientScripts/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ def main(job: Job, opts: NormalizeArgs, counter: DeferredFPRuleCounter) -> int:
if (
exitstatus != 0
and opts.purpose in ("access", "thumbnail")
and cl.commandObject.output_location
and (not os.path.isfile(cl.commandObject.output_location))
and cl.output_location
and (not os.path.isfile(cl.output_location))
):
# Fall back to default rule
try:
Expand Down Expand Up @@ -614,7 +614,7 @@ def main(job: Job, opts: NormalizeArgs, counter: DeferredFPRuleCounter) -> int:
# Store thumbnails locally for use during AIP searches
# TODO is this still needed, with the storage service?
if "thumbnail" in opts.purpose:
thumbnail_filepath = cl.commandObject.output_location
thumbnail_filepath = cl.output_location
thumbnail_storage_dir = os.path.join(
mcpclient_settings.SHARED_DIRECTORY, "www", "thumbnails", opts.sip_uuid
)
Expand Down
18 changes: 7 additions & 11 deletions src/MCPClient/lib/clientScripts/transcoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,22 @@ def __init__(
self, job, fprule, command, replacement_dict, opts, on_success, counter
):
self.fprule = fprule
self.command = command
self.replacement_dict = replacement_dict
self.opts = opts
self.on_success = on_success
self.commandObject = Command(
job, self.command, replacement_dict, self.on_success, opts
)
self.cmd = Command(job, command, replacement_dict, on_success, opts)
self.counter = counter

def __str__(self):
return (
f"[Command Linker] FPRule: {self.fprule.uuid} Command: {self.commandObject}"
)
return f"[Command Linker] FPRule: {self.fprule.uuid} Command: {self.cmd}"

Check warning on line 119 in src/MCPClient/lib/clientScripts/transcoder.py

View check run for this annotation

Codecov / codecov/patch

src/MCPClient/lib/clientScripts/transcoder.py#L119

Added line #L119 was not covered by tests

@property
def output_location(self):
return self.cmd.output_location

def execute(self):
"""Execute the command, and track the success statistics.
Returns 0 on success, non-0 on failure."""
self.counter.record_attempt(self.fprule)
ret = self.commandObject.execute()
ret = self.cmd.execute()
if ret:
self.counter.record_failure(self.fprule)
else:
Expand Down

0 comments on commit 09ed00e

Please sign in to comment.